Re: libjpeg thread safe constraint is not must

Przemysław Sobala <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
W dniu 01.08.2017 o 15:42, Bob Friesenhahn pisze:
> On Tue, 1 Aug 2017, yzh杨振宏 wrote:
>
>> Since GM is running on centos 7 in our case, and man pages clearly 
>> document setjmp() and longjmp() are thread safety:
>>
>>       │Interface               │ Attribute     │ Value   │
>>       ├────────────────────────┼───────────────┼─────────┤
>>       │setjmp(), sigsetjmp()   │ Thread safety │ MT-Safe │
>>       ├────────────────────────┼───────────────┼─────────┤
>>       │longjmp(), siglongjmp() │ Thread safety │ MT-Safe │
>>       └────────────────────────┴───────────────┴─────────┘
>> http://man7.org/linux/man-pages/man3/setjmp.3.html
>>
>> Does this mean we can use multi-thread for JPEG images on centos 7?
>>
>> I also note that setjmp/longjmp are also used in PNG err handle, and 
>> GM let user confirm and define a SETJMP_IS_THREAD_SAFE flag to open 
>> multi-thread feature. If core of the problem is not libjpeg itself 
>> but thread safety of setjmp/longjpm as you said, could GM use the 
>> same flag for JPEG multi-thread?
>
> I just added support for SETJMP_IS_THREAD_SAFE in the JPEG coder in 
> Mercurial.  Other formats which are declared unsafe are JPEG 2000 and 
> TIFF, but they are declared unsafe for other reasons.
>
> Bob
>
I've checked this flag with jpeg and png encoders and noticed a 3x 
speedup. Finally my CPU is being saturated when encoding as many files 
in parallel as I have cores.
I think most API users will benefit from this change and it should be 
make more accessible (e.g. via a configure option or even somehow 
autodetected).
--
Regards
Przemysław Sobala

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.