Fork me on GitHub
#parinfer
<
2018-02-07
>
tianshu06:02:43

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

shaunlebron16:02:58

not that bad, but about 10x slower than js

dominicm16:02:37

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

shaunlebron17:02:42

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

shaunlebron17:02:23

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

cfleming22:02:55

@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.

cfleming22:02:35

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

shaunlebron22:02:37

@cfleming yeah, I definitely want that in mainline

shaunlebron22:02:49

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

shaunlebron22:02:15

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

cfleming22:02:15

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

cfleming22:02:35

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

cfleming22:02:40

Ah, that might be it.

cfleming22:02:49

Otherwise I can reverse engineer it from what I have.

cfleming22:02:54

It’s pretty simple.

shaunlebron22:02:29

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

cfleming22:02:14

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

cfleming22:02:29

Is that specified by default somewhere when running using npm?

shaunlebron22:02:48

hmm, not sure

shaunlebron22:02:57

i bet it has to do with differing node versions

shaunlebron22:02:10

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

cfleming22:02:11

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

cfleming22:02:59

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.

cfleming22:02:31

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

shaunlebron22:02:51

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

cfleming22:02:11

@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.

cfleming23:02:19

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

cfleming23:02:05

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

shaunlebron23:02:26

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

shaunlebron23:02:25

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

shaunlebron23:02:41

yeah, line numbers should be the same

shaunlebron23:02:10

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

shaunlebron23:02:28

for example:

(foo
  bar
  )

(baz)
(foo
  bar)

(baz)

shaunlebron23:02:56

parlinter does this when used with the trim option:

--trim                   Remove lines that become empty after linting.