microsoft / BosqueLanguage

The Bosque programming language is an experiment in regularized design for a machine assisted rapid and reliable software development lifecycle.
Other
5.25k stars 298 forks source link

Update list performance #157

Closed khoshroomahdi closed 4 years ago

khoshroomahdi commented 5 years ago

As i know functional programming is slower than oop to update list with million records because they make a copy of list and then update that copy. How do you handle thus issue on bosque to improve performance?

raphaelkieling commented 5 years ago

it's a good question, but it's a caracteristic of most funcional languages, right? I find a question in stackoverflow here about that. But i did want know about that on Bosque

orcmid commented 5 years ago

I think we need to separate how one expresses such things in an economical but straightforward manner. Then worry about how implementations can expedite operation by virtue of the supplied means of expression.

The question of syntax and language for this came up in #14. See https://github.com/Microsoft/BosqueLanguage/issues/14#issuecomment-489163033

As @khoshroomahdi remarks, there are difficulties with purely-functional approaches, although array/dictionary types help, along with techniques such as those in Chris Okasaki's book, Purely Functional Data Structures.

For me, the bugaboo is over-reliance on assignment and needing, instead, some efficient form of copying if immutability is to be kept as reliable as possible, including "efficient" access to interiors of large structured entities. Millions of records is very akin to a database system problem, not so much a programming-language problem.

NWCalvank commented 5 years ago

Having read the various mission statements of sorts that Bosque has provided so far, it does seem to me that the focus is primarily on developer experience & complexity management over a deep focus on language performance.

With that said, there are potential solutions to the performance concerns. If I understand the runtime correctly, Bosque runs in Nodejs and is built on TypeScript. Being that TypeScript is an extension of JavaScript, other solutions from the JS community should be fairly applicable here as well.

For example, last I checked, ImmutableJS deals with large data structures by making a new instance of only the new/altered elements and leaving a link to the rest of the original data structure to "fill in" the rest.

This isn't necessarily the solution that Bosque wants, but I think it could help shine some light on creative solutions that other people working with a similar language have developed.

orcmid commented 5 years ago

@NWCalvank I speculate that the use of node.js and TypeScript is more proof-of-concept than the ultimate intended platform/environment. I agree that some form of copy-on-write can be looked into, and the next performance case has to do with access to constituents, not just deep alterations.

I still contend that "millions of records" should not be an use case, no matter however appealing it is to express such a thing. The amortization of overhead is just too different, I suspect.

mrkmarron commented 4 years ago

Merge with issue #103