News for hackers. Stuff that matters.
Re:Adventures in the land of substrings and RegExps by mrkgnao on Saturday December 03, 2016 @10:02AM (#13095898)
Now I'm really interested in the SpiderMonkey/V8 thing.

Also,

> Solution’s simplicity and elegance might provide a welcomed retreat from fighting Webpack configs.

I chuckled.

Re:Adventures in the land of substrings and RegExps by jandem on Saturday December 03, 2016 @09:31PM (#13098511)
> Now I'm really interested in the SpiderMonkey/V8 thing.

I think SpiderMonkey is 60x faster than V8 there because of an optimization we have to avoid quadratic behavior while flattening ropes, it's described here: http://searchfox.org/mozilla-central/rev/0f92c398ce929a3f3d9...

Basically JS engines do string concatenation lazily: they create a rope, and then the rope is flattened when needed [0]. When appending/concatenating one character at a time and flattening after each concatenation, we avoid quadratic behavior (copying the same chars over and over again while flattening) by overallocating so we can simply append while flattening. The source code comment has the full details.

[0] https://en.wikipedia.org/wiki/Rope_(data_structure)

Re:Adventures in the land of substrings and RegExps by imagist on Saturday December 03, 2016 @10:24AM (#13095984)
Yeah, I did too.

I just don't understand the obsession with configuration oriented programming these days. Sure, it looks nice for common paths, but as soon as you're doing anything they don't have an option for, you have to write code just like before. But now the choice toy have to write is some awful hack bolted on to the side of your configuration. It's a mess.

Re:Adventures in the land of substrings and RegExps by draw_down on Saturday December 03, 2016 @11:02AM (#13096165)
I laughed at this part:

> However when I did necessary changes to the less_dart code I discovered that it actually became several times slower. Hmm.

It's almost like those kuh-razy V8 people knew what they were doing and wrote all that code for a reason.

Re:Adventures in the land of substrings and RegExps by __derek__ on Saturday December 03, 2016 @02:15PM (#13097031)
The author is a compiler engineer on the V8 team.
Re:Adventures in the land of substrings and RegExps by mraleph on Sunday December 04, 2016 @05:32AM (#13099509)
> It's almost like those kuh-razy V8 people

I don't get what's the connection between V8, less_dart and naive implementation that `RegExp.matchAsPrefix` had in Dart VM.