SUModelSaveToFileWithVersion has performance regression in version sketchup toolkit 21.0.339

Hi Experts,

Recently we update Sketchup toolkit from version 20.0.363 to version 21.0.339, there is a performance regression during saving sketchup files.

Can you take a look at this issue? I am not sure if you can reproduce this issue. If you can’t, what can I for you to help you reproduce this performance regressions?

Please post code correctly in the forum (and in the API Issue Tracker)
not screenshot images showing code:

If you post an issue in the tracker, please provide a full reproducible code and an example model that shows the differences in save time.


However, with the Release of SketchUp version 21 a new compressed archival format was introduced for SKP files.

From the SketchUp Application Release Notes:

Under the hood: a re-built .SKP

SketchUp 2021 brings to light a significant under-the-hood improvement: a re-build of the .SKP file format. You are likely to notice a significant reduction in file sizes when saving models to the new format, and we’re excited about additional workflow improvements this new file format will unlock going forward.

Soif your test is now saving in the new compressed archival version 21 format, then it is expected that the save process will take some amount more time than the older pre-21 non-compressed binary format.

I don’t know what the average is. 15% doesn’t sound like too much (to me.)

EDIT: Actually with your reported times, it appears to take 30% more time.

@DanRathbun I just realized API issue should be reported in API Issue Tracker. I thought it was Sketchup SDK issue and then reported here (it is wrong place). Next time I will strictly follow up the rules.

Thanks for your information. Updating the toolkits was another person. So I missed the important release information about saving in the new compressed archival version 21 format. But I quite noticed the file size is reduced.

The generated sketchup file size is close to 220M. Is it possible that the bigger the file size of the generated skp file, more save time being taken?

Yes, this would be a naturally conclusion for any format version, I would think.

Thanks for your help.

1 Like

Now do we have a chance to save as the non-compressed binary format?

Yes set the version parameter to one of the values for an older pre-21 version.

for an older pre-21 version, do you mean the version like " SUModelVersion_SU2017, SUModelVersion_SU2018, SUModelVersion_SU2019, SUModelVersion_SU2020" etc.

I tried to call the API SUModelSaveToFileWithVersion with version “SUModelVersion_SU2020”, the time is not reduced.

Yes, this is what I meant.

Does the file’s internal version indicate 20 or 21 ?

Where to know the file internal version? If specify the version 2020, why its internal version is 21? I’m sorry that I don’t get your point.

Manually:

  • Open the test file in SketchUp 2020, and if it opens you can open the Model Info dialog, then switch to the “File” panel and see the version displayed.
    • If it does not open a messagebox should appear saying that the file version is newer than the application version.
    • (Note that because they are attempting to make the new SKP format more portable between versions, they have removed the Version display field from the Model Info > File panel in 21.0.)

Via APIs:

We have issues logged for this (but not yet implemented):

There are Ruby snippets that can get this from an external file in this old issue …

You can get an indication (from a C app) that a file was saved with an newer API version via SUModelLoadStatus which is returned when using the SUModelCreateFromFileWithStatus function.

Oh here is the C API function to read the open model’s save version…

Hi @xqtyler, Thanks for the report.

This slowdown is most likely due to model validity checks which we have to run when saving in the new file format. Prior to 2021, the C API did not do that consistently, which resulted in faster saves. But it could result in models with validity errors. Our benchmarks show that the saving itself is not perceptibly slower with the new format.

Rest assured that we are looking into speeding up the validity checks.

3 Likes

According to the discussion above, now it seems there are two possible causes which introduce the extra time cost.

  • File compress in new version

    • According to the test result, switch to prior to 2021, the time is not reduced. So the performance regression seems not be caused by it
  • Model validity check

    • For the model validity check, is it possible to provide an option to let clients decide if require the model validity check during saving in the new file format? If the version is set to prior to 2021, is the model validity check skipped? I tried to save as version 2020, it seems the time is not reduced.

Based on the new version toolkit, what can I do to keep the saving time as before?

They say that “saving” time is still “about the same” as before. But I myself think the new format must add some time over and above the old binary format. I asked Bugra to come and give his opinion because he knows more than I about this subject.

Not entirely. The validity checking has been increased over the past few major versions.

No there is no such option. The increase in save time will ensure more stable model files.
Back saving too many versions will remove newer features such as tag (layer) folder support.

Validity checking is not dependent on the model format version and it is currently not optional. I am a bit surprised this is such a showstopper for you since we have not heard any other complaints. Can you share an example model you are looking at?

1 Like

Hi @DanRathbun and @bugra,

Thanks a lot for your comments and help. I’m ok with current behavior of new version.

The input model is xml file written by ourselves. It is not convenient to share to look at it. I will hold my issue till hear any complaints.

Do you see similar timings when working with Collada files?