Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.95k stars 554 forks source link

Newsvuvnviv taint api speedup #22662

Open bulk88 opened 1 week ago

bulk88 commented 1 week ago

inspire by looking at bug https://github.com/Perl/perl5/issues/22653, and remarks in the past over these 3 fns being super important esp for enterprise serialization/deserial/wire format decoding.

They are also sort of related to a very bad failed optimization (MSVC compiler went to "-O0" and added 100s of KBs of redundant code in perl541.dll and some KBs more in XS DLLs), done 2-3 years ago in perl core. But im still working on a fix/diag/analysis/solution for that. This branch of commits covers more about serial/deserial performance, and taking unique advantage that IV NV UVs are no-malloc SV and that they are bodyless.

Plus in one spot, my additional "bodyless" optimization from some years ago disappeared through code churn at https://github.com/Perl/perl5/commit/915544426781d184e3b057e63a20c089a32d3eba I put it back, since bodyless SVs are very light weight. And newSV_type() is very heavy with many many branches inside.

richardleach commented 1 week ago

newSV_type() is very heavy

The intention was always that calls to newSV_type() with a static type argument would be inlined. (Hence, your bodiless optimisation would not have disappeared.) Are you finding that this is not the case? Because of -O0?

richardleach commented 1 week ago

newSV_type() is very heavy

The intention was always that calls to newSV_type() with a static type argument would be inlined. (Hence, your bodiless optimisation would not have disappeared.) Are you finding that this is not the case? Because of -O0?

Ah, I've seen there's some discussion on #p5p. I'll try to catch up on that tonight.

bulk88 commented 1 week ago

repushed branch, fixed -DNO_TAINT_SUPPORT build failure

jkeenan commented 5 days ago

This p.r. has repeatedly failed to build on one of our CI setups. Please see: https://github.com/Perl/perl5/actions/runs/11336336622/job/31611461445?pr=22662

bulk88 commented 5 days ago

fixed asserts for 32b ptr builds

bulk88 commented 4 days ago

macOS (Monterey) 12 (-Uusethreads) passed.

I did no changes except for moving a static assert that failed i386.

macOS (Monterey) 12 (-Uusethreads)

now

#   Failed test 'write: stat and lstat returned same values'
#   at t/stat.t line 44.
#     Structures begin differing at:
#          $got->[8] = '1729155292.99179'
#     $expected->[8] = '1729155292.76969'
# Looks like you failed 1 test of 43.
../dist/Time-HiRes/t/stat.t .......................................... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/43 subtests 

is this a flip flop timing test that fails regularly?

 8 atime    last access time in seconds since the epoch

IIRC Win NT kernel API refuses to update access time any faster than 1 full second.

bulk88 commented 4 days ago

https://github.com/khwilliamson/perl5/commit/68c1b38c44c593a83207de9c96e39fd2d4ee463e

https://github.com/Perl/perl5/issues/19321

related bug tickets I found

for

#     Structures begin differing at:
#          $got->[8] = '1729155292.99179'
#     $expected->[8] = '1729155292.76969'