davidism,
@davidism@mas.to avatar

Python has seen significant performance improvements in the last few releases. MarkupSafe has a C extension to speed up operations, but it's now slower in many cases than the plain Python implementation. Having a C extension increases the difficulty of maintenance, builds, releases, and installs. I'm wondering if it's time to drop the speedups. https://github.com/pallets/markupsafe/issues/433

davidism,
@davidism@mas.to avatar

Update: the speedups have been sped up, so they remain! https://elk.zone/mas.to/@davidism/112299314503122260

tonybaloney,
@tonybaloney@fosstodon.org avatar

@davidism submitting a PR to make the C extension about 30-40% faster.

glyph,
@glyph@mastodon.social avatar

@davidism @freakboy3742 I am very curious what happens if you mypyc or cythonize the python?

davidism,
@davidism@mas.to avatar

@glyph @freakboy3742 It would be interesting, but I'd have to learn how to do either of those things. It wouldn't simplify the maintenance surface or build/install complexity. Are you thinking they would be faster than the hand written C? It's already pretty clever, I'd be really surprised if they figured out the weird UCS1/2/4 byte manipulations which is where most of the speed is.

glyph,
@glyph@mastodon.social avatar

@davidism @freakboy3742 no, just that they might win back some of the loss by moving back to pure python, with relatively low additional build maintenance and zero additional source maintenance (as opposed to a whole duplicated implementation in C or even Rust)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • ngwrru68w68
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • GTA5RPClips
  • Youngstown
  • everett
  • slotface
  • rosin
  • osvaldo12
  • mdbf
  • kavyap
  • cisconetworking
  • JUstTest
  • tester
  • normalnudes
  • cubers
  • khanakhh
  • Durango
  • ethstaker
  • tacticalgear
  • Leos
  • provamag3
  • anitta
  • modclub
  • megavids
  • lostlight
  • All magazines