parinfer

tianshu 2018-02-07T06:30:43.000167Z

parsing the file with 2.8k lines will cost 180ms in emacs.

shaunlebron 2018-02-07T16:14:58.000029Z

not that bad, but about 10x slower than js

dominicm 2018-02-07T16:36:37.000616Z

Maybe there's some way to optimize it? I'm sure most elisp is far less performance sensitive than this.

shaunlebron 2018-02-07T17:51:42.000853Z

i think most elisp things aren’t doing the type of string building that parinfer is doing

shaunlebron 2018-02-07T17:55:23.000575Z

planning on making parinfer return edits instead of a full string: https://github.com/shaunlebron/parinfer/issues/158

cfleming 2018-02-07T22:15:55.000365Z

@shaunlebron It would be great to get that into mainline - I fixed that bug in the Cursive port yesterday, and it was due to the differences in char counting because I return edits.

cfleming 2018-02-07T22:16:35.000248Z

So if mine could be more in line with mainline parinfer that would help me a lot.

shaunlebron 2018-02-07T22:17:37.000560Z

@cfleming yeah, I definitely want that in mainline

shaunlebron 2018-02-07T22:17:49.000180Z

sorry for the problems related to that, glad you found it

shaunlebron 2018-02-07T22:18:15.000181Z

i don’t think i remember where that is right now in the js version

cfleming 2018-02-07T22:18:15.000481Z

It complicates the editor integration a bit, because you have to specify the algorithm for applying the edits.

shaunlebron 2018-02-07T22:18:29.000069Z

i see this: https://github.com/shaunlebron/parinfer/pull/170

cfleming 2018-02-07T22:18:35.000369Z

Me either, I did have it in a branch somewhere.

cfleming 2018-02-07T22:18:40.000006Z

Ah, that might be it.

cfleming 2018-02-07T22:18:49.000561Z

Otherwise I can reverse engineer it from what I have.

cfleming 2018-02-07T22:18:54.000176Z

It’s pretty simple.

shaunlebron 2018-02-07T22:19:29.000489Z

i won’t be able to look at it this weekend

cfleming 2018-02-07T22:20:14.000256Z

BTW when running the tests, I had to add a "use strict" to build.js, because it uses let

cfleming 2018-02-07T22:20:29.000554Z

Is that specified by default somewhere when running using npm?

shaunlebron 2018-02-07T22:20:48.000303Z

hmm, not sure

shaunlebron 2018-02-07T22:20:57.000612Z

i bet it has to do with differing node versions

shaunlebron 2018-02-07T22:21:10.000209Z

wish I could specify that in package.json, maybe I can

cfleming 2018-02-07T22:21:11.000379Z

Ah, could be - I have no idea which version I’m using.

cfleming 2018-02-07T22:21:59.000192Z

Anyway, I have a minor regression with two tests around error locations, but I’m hoping to be able to push a dev build today so you can check out the indentation marking.

shaunlebron 2018-02-07T22:23:12.000161Z

sweet!

cfleming 2018-02-07T22:23:31.000206Z

And I can get some more Cursive users trying it out too.

shaunlebron 2018-02-07T22:27:51.000377Z

yeah, can’t wait to see what cursive users think. lot of parinfer users there

cfleming 2018-02-07T22:28:11.000034Z

@doglooksgood Are you splitting the file into lines, or processing the whole file in one go? parinfer-js currently splits the file into lines, which makes some things easier but is not necessary. It’s also harder on the GC, and I don’t think Emacs’ GC is stellar.

cfleming 2018-02-07T23:14:19.000333Z

@shaunlebron Am I correct in thinking that there’s actually no difference between result.lineNo and result.inputLineNo?

cfleming 2018-02-07T23:29:05.000026Z

Actually, if that’s too down in the weeds when you’re not looking at the code, I can file an issue.

shaunlebron 2018-02-07T23:42:26.000305Z

@cfleming: I’m 90% sure that they are always the same

shaunlebron 2018-02-07T23:43:25.000309Z

there was a case where I was considering splitting lines when dealing with leading close-parens

shaunlebron 2018-02-07T23:48:41.000026Z

yeah, line numbers should be the same

shaunlebron 2018-02-07T23:49:10.000131Z

in the future though, I want to remove lines that are made empty by parinfer

shaunlebron 2018-02-07T23:49:28.000244Z

for example:

(foo
  bar
  )

(baz)
(foo
  bar)

(baz)

shaunlebron 2018-02-07T23:50:04.000083Z

@cfleming: ^

shaunlebron 2018-02-07T23:50:56.000310Z

parlinter does this when used with the trim option:

--trim                   Remove lines that become empty after linting.