delaneyj / three.net

C# port of Three.js
MIT License
79 stars 25 forks source link

Sharp Fire() with a quick Linq optimization #1

Closed aloisdg closed 9 years ago

aloisdg commented 9 years ago

I will propose a lot of small modifications like this one, if you agree. Does Sharpification of the code include Coding Conventions, Linq optimization, var keyword utilization, this removal, etc.?

delaneyj commented 9 years ago

In general yes I wan to utilize all of the features of modern C# where appropriate.

Things like this removal, code conventions, var usage are all probably going to merged without much concern. When you say linq optimization I think we need to look at actual profiling metrics because for foundational (low level if you will) 3d engine related stuff this can add up. I'm all for Linq in game/busniess logic areas, but i'd consider even removing the foreach usage and going for straight for(var i=0... depending on the profiling.

Are there actual optimizations that I'm unaware of for Linq?

aloisdg commented 9 years ago

When you say linq optimization I think we need to look at actual profiling metrics because for foundational (low level if you will) 3d engine related stuff this can add up.

I use the wrong word. I thought about readibility and clean code. As far as I know, Where is slower than a foreach loop. The difference between for and foreach is near 0 but still exist.

Stack Overflow agrees with us. See 1 and 2.

You can reject this merge. I think a nice idea would be to add a Contributing doc or add this note to the readme. :)

delaneyj commented 9 years ago

Great points, I will add some more detail to the README (specifically about linq for example).

Please don't hesitate to help with the general style of the project, but adding linq for brevity at this level should be avoid until we have 100% functionality with the original Three.js.

migueldeicaza commented 9 years ago

In general, it is a good thing to avoid LINQ in frameworks. As noted above, it is slower and also generates unwanted garbage at runtime.

And unlike user code, the end user usually has no control over this, so it is best to avoid it in principle

delaneyj commented 9 years ago

You don't know how happy it makes me to see you in the issues @migueldeicaza. Do you think its possible to find some help getting the cross platform-ness of this project started? I had originally just done on the work on a single machine, even the VS2013 support is a bit cludegy. I would LOVE to see a proper xamerian/vs solution/project structure. I'm totally open to revamping anything structurally to make this happen.

aloisdg commented 9 years ago

@delaneyj xamarin ;)

@migueldeicaza Good point. Thank you for mention it.

A bit off topic, but before editing Coding Coventions, it may be nice to select the Mono Coding Style or the Microsoft Coding Style.

delaneyj commented 9 years ago

@aloisdg I honestly don't know the differences, will have to look into it. Do you have a suggestion? Pros/Cons? If @migueldeicaza and associates can help get this into a better state for cross platform I'd be happy to bow to their needs.

aloisdg commented 9 years ago

@delaneyj There is a lot of debate about coding style. I don't think there is a true right way to do it. I am going to open an new issue for this topic.

migueldeicaza commented 9 years ago

Hey guys, only today I setup a solid filter for github notifications, sorry about that.

While I would love to help, I am not sure that I have much time right now, but perhaps we can reach out to folks in the mono-list mailing list?

delaneyj commented 9 years ago

Hey @migueldeicaza. I figured you wouldn't have the time directly but if you know the right kind of people to get this working within the Xamarin development world it would be greatly appreciated!