Skip to content

Conversation

@kalwalt
Copy link
Member

@kalwalt kalwalt commented Mar 21, 2025

This pull request includes several updates across multiple files to improve performance, update dependencies, and enhance functionality. The most significant changes include updating the Node.js version in the README.md, adding threading support for feature map generation in the markerCreator and threaded_featureMap files, and improving error handling and memory management in the NFTMarkerCreator.js.

Node.js Version Update:

  • Updated the Node.js version to 20 in the README.md file.

Performance Improvements:

  • Added threading support for feature map generation in emscripten/markerCreator.cpp and introduced a new threaded_featureMap.cpp file for threaded feature mapping. [1] [2]
  • Replaced fopen and fwrite with std::ofstream for file operations in emscripten/markerCompress.cpp.

Codebase Simplification:

  • Replaced #define macros with constexpr for constants in emscripten/markerCreator.cpp.
  • Removed unnecessary platform-specific includes and macros in emscripten/markerCreator.cpp. [1] [2]

Error Handling and Memory Management:

  • Added error handling in the Module.onRuntimeInitialized function in src/NFTMarkerCreator.js.
  • Set a memory limit for Node.js processes to 4GB in src/NFTMarkerCreator.js.

Dependency Updates:

  • Updated the prettier dependency to version 3.5.3 in package.json.

These changes collectively enhance the project's performance, maintainability, and robustness.

@kalwalt
Copy link
Member Author

kalwalt commented Mar 21, 2025

The code now with the threaded feature may produce a NFT file 3 time faster, but require a bit of memory. I will do some tests for this.

@kalwalt
Copy link
Member Author

kalwalt commented Apr 9, 2025

I should add a print in the output to display the number of threads involved when used the --threaded option.

@kalwalt
Copy link
Member Author

kalwalt commented Apr 9, 2025

i tested with gcloud and with 16 core it is at least 4 times faster !! Maybe in some machine is better to specify how many threads to use, i will add also this option.

@kalwalt
Copy link
Member Author

kalwalt commented Apr 12, 2025

I need to do some tests with the generated nft markers (pinball.jpg) with the threaded option. I tested with the markers generated in on a remote host with jsartoolkitNFT, they can be loaded without any issues but when the app try to detect with a aebcam stream they are unable to detect (they are tdetected and suddenly lost). I noticed that .fset in respect of old one are 1 kb only instead of 12 kb; even .iset and .fset3 looks different, but this could be caused because the initial image was different. I would generate with and without --threaded option and compare both NFT markers.

@kalwalt kalwalt mentioned this pull request Oct 23, 2025
- Enhanced the threading implementation by ensuring proper locking mechanisms around critical sections.
- Added error handling for feature map generation, logging an error message and exiting if the feature map is NULL.
- Simplified the calculation of mindpi and maxdpi for feature sets, ensuring more robust handling of scale values.
- Cleaned up code structure for better readability and maintainability.
@kalwalt
Copy link
Member Author

kalwalt commented Oct 23, 2025

I tested the new NFT markers created with the threaded version of the app, they seems to works as expected, but i will make more text in the next days. Just one note about the creation, with 8 threads my laptop take around 60 seconds to create the NFT marker instead the not threaded version takes 210 seconds...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant