Open Sunge8081 opened 6 months ago
I think it's because ag-psd
is parsing the whole file in readPsd call, and then you have entire structure available to you, psd
library is only doing initial parsing and then it's processing the file when you're calling api functions on it, so the processing time is spread around in all of the functions. In this example you're not reading anything from the file, so the psd
library is skipping most of the work.
That said 2.453s is a lot of time, if it's possible for you to share the file I could look into performance issues and maybe improve it.
Is it possible to set ReadOptions and discard some options based on user customization to make reading psd faster?
我认为这是因为
ag-psd
在 readPsd 调用中解析整个文件,然后你就有了可用的整个结构,psd
库只进行初始解析,然后当你调用 api 函数时它正在处理文件,所以处理时间是分布在所有功能中。在此示例中,您没有从文件中读取任何内容,因此psd
库将跳过大部分工作。也就是说 2.453 秒是很多时间,如果您可以共享该文件,我可以研究性能问题并可能改进它。
This is my test psd file: https://gallery-dev-1318352346.cos.ap-guangzhou.myqcloud.com/upload/dev/gallery/public/2024-01-10/%E4%B8%BB%E5%9B%BE.psd
Just released version 20.1.0
with fix for the issue.
It was actually mostly decoding that huge 46MB xmpMetadata field, I improved utf-8 decoding/encoding, and now it should be really fast.
Just released version
20.1.0
with fix for the issue.It was actually mostly decoding that huge 46MB xmpMetadata field, I improved utf-8 decoding/encoding, and now it should be really fast.
Your improvement was so timely, and now the reading time has been reduced to within 100ms. It's great, thank you! It is very helpful for my current work!
console: ag-psd:readPsd: 2.453s PSD:readPsd: 909.677ms