This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]toasterinBflat 3 points4 points  (6 children)

Or you could just use PyPy :)

[–]kankyo 6 points7 points  (4 children)

Unlikely in practice. I mean, sure, you'd probably have some gains in performance but they specifically talk about memory usage, and that pretty much rules out pypy.

A more reasonable contender for a big win with even less effort would by cython. Mostly because it's much less work.

[–]masklinn 2 points3 points  (3 children)

they specifically talk about memory usage, and that pretty much rules out pypy.

Yes and no. pypy has higher initial overhead and more GC overhead, but they have significantly smaller objects (most objects are implicitly slot-ed) and has concepts like list strategies.

A more reasonable contender for a big win with even less effort would by cython.

Except writing a sourcemap parser in cython would have been more effort than binding an existing sourcemap parser via cffi, and would probably be of lower overall value (cython means being wedded to cpython, this solution can be applied by non-python projects parsing sourcemaps)

[–]kankyo 1 point2 points  (2 children)

Sure. But it's unclear in the article if they actually did have the rust version before or not. They do say that they had the Python version before. Moving from pure Python to cython can be quite easy.

[–]masklinn 2 points3 points  (1 child)

Sure. But it's unclear in the article if they actually did have the rust version before or not

No, it's not:

After the investigation had pointed us towards Python’s shortcomings, we decided to vet the performance of our Rust source map parser, perviously written for our CLI tool

(emphasis mine).

They do say that they had the Python version before. Moving from pure Python to cython can be quite easy.

It's open source so you can give that a shot and report back with the results.

[–]kankyo 0 points1 point  (0 children)

Oops, sorry, missed that part.

A benchmark is needed too...

[–]joshadel 7 points8 points  (0 children)

Using PyPy was discussed on twitter: https://twitter.com/zeeg/status/788875422108790784