Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip/tree shake debug code #13

Open
vicb opened this issue Mar 26, 2021 · 7 comments
Open

Strip/tree shake debug code #13

vicb opened this issue Mar 26, 2021 · 7 comments

Comments

@vicb
Copy link
Contributor

vicb commented Mar 26, 2021

It would be nice to be able to strip (or tree shake) the debug/test geojson code especially to reduce the payload for websites.

For tree shaking the debug code should be moved out of the class.

Maybe also switch to Typescript ?

@mmomtchev
Copy link
Owner

The gain will be less than 1Kb I think? But still, maybe there should be some way to remove that code altogether in a production buiild
When I started this project, it was meant as a support tool, along igc-admin-analyze, for my linear regression analysis of weather data and XC scores - a project that did not turn out to be a great success - except for rediscovering the importance of ambient pressure already known since the Age of Sail

Just as pfd, it was initially a Python project with multithreading support
Then, at some point, I decided to hastily hack a JS version - a monothreaded one - to compare the performance - and to my greatest surprise, the mono-threaded JS version outperformed the Python multithreaded one - with or without PyPy

So in fact, this project grew out of a hack and I considered it mostly abandonware 😄

Initially I didn't want to have any dependencies, but now that it is an ES6 module that must be transpiled anyway, I could as well use Typescript. But in fact, just a few days ago I was even considering a complete rewrite in C++ - so that it can be embedded in flight instruments. This year is going to be my first year with a real flight computer and I am still looking at all available options - and whatever I choose, I will surely consider an embedded port. I will probably start with an Onyx Boox.

@vicb
Copy link
Contributor Author

vicb commented Mar 26, 2021

The gain will be less than 1Kb I think? But still, maybe there should be some way to remove that code altogether in a production buiild

There is no small gain ;)

Making it tree shakeable should be easy, just move the method out of the classes in a different module. You can still access the members (it might look like getBoxJson(box)).

Those days the v8 VM is pretty efficient and I would be curious about the gain you can have with a C++ implementation. Still it is possible to compile C++ to WebASM.

With regards to flight instruments I like XCTrack on Android, FlyME on Android is nice too and they can already optimize the flights in real time. I run XCTrack on a $100 android phone.

@mmomtchev
Copy link
Owner

XCTrack is currently my first choice - initially I intended to write my own 😄 - but XCTrack is so good that one cannot justify rewriting it
One of the authors of XCTrack is Ondrej who is the original creator of this algorithm, yet there is no scoring in it?

@mmomtchev
Copy link
Owner

I was also thinking about adding support for Box points - so that it can show you a score-maximizing point in a, let's say 3km or 5km radius - by closing a triangle or by getting closer to an FAI triangle - but there is not point implementing this in JS/TS - this feature belongs to a C++ implementation

@vicb
Copy link
Contributor Author

vicb commented Mar 26, 2021

One of the authors of XCTrack is Ondrej who is the original creator of this algorithm, yet there is no scoring in it?

Yes there is scoring.

  • While you are flying it will show you the best triangle/fai you can close,
  • When you look at a recorded track, it would score it for you.

@vicb
Copy link
Contributor Author

vicb commented Mar 26, 2021

@vicb
Copy link
Contributor Author

vicb commented Mar 27, 2021

Also Tom Payne has a C implementation (used by the FFVL).
It might be interesting to contact him to at least get some benchmark.

See https://github.com/twpayne/xcscore-js/blob/master/README.md

More sophisticated algorithms are used for scoring real GPS tracklogs with tens of thousands of points. Contact the author for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants