Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Typescript migration #85

Open
Grimones opened this issue Feb 26, 2019 · 2 comments
Open

Typescript migration #85

Grimones opened this issue Feb 26, 2019 · 2 comments

Comments

@Grimones
Copy link

Hi @stephomi

First of all I'm really impressed that you have made a sculpting program on pure JS which runs on every device smoothly

I've seen that you used a mix of es5 and es6. I already started a PR with upgraded webpack v4 and eslint + prettier and suddenly found your tweet that it has perf issues with using const and let.
I can say that i didn't noticed a really big issues (win10 chrome 72.0.3626.119) with let and const, but there was a little regression, like 5-10%.
However it's also possible to process all code through babel and get var.

Also I found some possible issues here
https://github.com/stephomi/sculptgl/blob/master/src/Scene.js#L628-L639
What mesh it returns? The last one from loop? Or somewhere from the upper scope?

And this one is interesting. Not sure that it was done on purpose
https://github.com/stephomi/sculptgl/blob/master/src/misc/getOptionsURL.js#L84

if (->tInt === tInt<- && tInt >= 10) key = tInt;

If you are interested in this, I could make a PR.
Also, it would be worth to make some tests, both unit and perf.
Perf tests could be done with puppetter but only chrome based. I think they might be useful.

Regarding the subject. There is a gazillion lines of code which is hard to understand at first glance and it's really easy to get lost which function or type is returning increasing chances to get cannot get property fu of undefined error.
Also, I have seen the C++ comparison. Maybe it's worth to implement the heaviest in terms of processing things using Assembly script?
It's almost same as typescript, it can reuse some bits of browser code (like constants) and it doesn't have any glue code. Some info here and here. I'm not an expert, but it seems to be a good choice using it along with typescript in project.

What do you think? I'm happy to help with all this, except linear algebra stuff 😅 but i'm keen to learn.

P.S. I have seen an issue somewhere here, that it would be awesome to have a native app for iOS using all variety of gestures it gives. I assume that it's possible to make it using React Native. All JS/Wasm logic could be reused across desktop, browser and mobile. When on mobile with RN it's possible to make bridges/bindings for native stuff like gestures.

@disjukr
Copy link
Contributor

disjukr commented Feb 26, 2019

maybe tInt === tInt is NaN checking

@stephomi
Copy link
Owner

Hey, thanks for your interest!
Unfortunately, I'm not really active on sculptgl, except for a few quick experiments here and there.
The C++ version is closed source and will probably stay that way.

Also I found some possible issues here
https://github.com/stephomi/sculptgl/blob/master/src/Scene.js#L628-L639
What mesh it returns? The last one from loop? Or somewhere from the upper scope?

The last one from the loop, but the variable should indeed be declared outside the loop though (prettier should detect those normally).

And this one is interesting. Not sure that it was done on purpose
https://github.com/stephomi/sculptgl/blob/master/src/misc/getOptionsURL.js#L84

Cf @disjukr answer.

and suddenly found your tweet that it has perf issues with using const and let

Yep my tweet dates from 2016 and the issue doesn't exist anymore.
I still have my test pages, and the performance is the same:
https://stephaneginier.com/archive/testperf/indexLet.html
https://stephaneginier.com/archive/testperf/indexVar.html

I already started a PR with upgraded webpack v4 and eslint + prettier
If you are interested in this, I could make a PR.

As I said previously, I'm not active anymore on sculptgl so I would be wary PRs with lot of changes.
But if it's just a webpack+es6+eslint+prettier, I could definitely merge it (const/let is fine as well).
Ideally, I'd also like to remove electron from the package.json, I think it makes the initial checkout too big.
And there's also this part (https://github.com/stephomi/sculptgl/blob/master/package.json#L24-L27) which is probably not great because of paths (issues slash/antislash)

Also, it would be worth to make some tests, both unit and perf.

Agreed, but considering I don't plan on adding new features it would probably be overkill.

There is a gazillion lines of code which is hard to understand at first glance and it's really easy to get lost which function or type is returning increasing chances to get cannot get property fu of undefined error.

Yep it certainly misses documentation.
There're also parts of the code that are terrible from a usability pov (shader management).

Also, I have seen the C++ comparison. Maybe it's worth to implement the heaviest in terms of processing things using Assembly script?

Probably too big of a change for me!

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

No branches or pull requests

3 participants