Creating many bookmarks fast

Use case

I need to create a lot of bookmarks, thousands in the absolute worst case, but typically dozens to a couple hundred.

Goal

I have a bookmark tree structure in memory, and wish to “import” it into the browser’s bookmark collection.

Problem

Using bookmarks.create() is rather slow for large trees. I was hoping that there would be an alternative API method, accepting trees, or even any kind of iterable over bookmark nodes that would optimize the creation of the batch. However, as far as I can tell no such method exists or is planned to be implemented in the future.

Question

Is there anything I can do with the state of the API today to squeeze significantly better performance than just calling bookmark.create() for each node of the tree in memory?

What about converting your bookmarks into HTML or JSON format and importing data from bookmark panel. I think this is the most efficient way to do it.

If by that you mean go to the bookmark library window and manually import from there, then unfortunately no this is not an attractive option in my particular case. The import needs to be automated since it will be happening regularly. If there were an API method importFromJSON() or importFromHTML() that would be great but none exists…