yodaos-project / ShadowNode

Use Node.js in your end devices(QQ: 796448809)
https://yodaos-project.github.io/ShadowNode/
Other
588 stars 46 forks source link

url: refactoring the complete API in c/c++ #321

Open yorkie opened 6 years ago

yorkie commented 6 years ago

Is your feature request related to a problem? Please describe. The current URL implementation is copied from Node.js, which includes over 1000 lines JavaScript source code, it's better to implement it in C/C++ for performance and memory usage.

Describe the solution you'd like https://github.com/jacketizer/libyuarel looks good an alternative impl for URL.

yorkie commented 6 years ago

Another alternative is https://uriparser.github.io/doc/api/latest/ but it's written in C++.

ErosZy commented 5 years ago

I will try to resolve this feature, it looks fun.

ErosZy commented 5 years ago

jerry and iotjs 's apis seem no utf8 string operation functions, i'm going to add some functions to utf8, but I don't know where to write these operations.

In addition, we want to rewrite all APIs to c/c++ as much as possible?

legendecas commented 5 years ago

What utf8 operations would you like to use?

ErosZy commented 5 years ago

What utf8 operations would you like to use?

just like codeUnit or other something. there are many charCodeAt operation in the url.js, you can see here. if want to rewrite as much as possible using c/c++, utf8 string operations are indispensable.

legendecas commented 5 years ago

For the case you mentioned, jerry_substring_to_utf8_char_buffer might appropriate to use.

ErosZy commented 5 years ago

jerry_substring_to_utf8_char_buffer

I don't know if there is a performance problem with this method. There is a copy operation inside, but we will get one point code frequently.

I rewrite it using jerry_substring_to_utf8_char_buffer firstly anyway. thanks @legendecas :)

ErosZy commented 5 years ago

I have done some, it will take some time to estimate (about 2days) , but my work is a bit busy now, it is not guaranteed. if you have time, you can take over it :(

legendecas commented 5 years ago

@ErosZy Hey, it's not in such a hurry. You could take your time. :)