I need some help on some ideas

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

I need some help on some ideas

yyl_20050115@hotmail.com
Hi dear lua list members,

About 2 months ago, I started working on a new algorithm for c++ to do memory management by reference counting algorithm.
That project was successfully completed.

Later, I was seeking for another use case, and then I found Lua.
Lua is small and elegant, pure c implemented and therefore most portable.

I want to code the algorithm into a custom version of Lua to make it support reference counting.

And I'm already working on it now (based on Lua 5.4).

The problem I've encountered is, I'm not sure where to change: I'm still learning lua, both the language and the implementation.

Would you please kindly help me to point out where I should notice while coding this algorithm?

The rclua project is here:


Waiting for your reply.

Best Regards,
Yilin

Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Ranier Vilela-2
Em ter., 6 de out. de 2020 às 07:14, [hidden email] <[hidden email]> escreveu:
Hi dear lua list members,

About 2 months ago, I started working on a new algorithm for c++ to do memory management by reference counting algorithm.
That project was successfully completed.

Later, I was seeking for another use case, and then I found Lua.
Lua is small and elegant, pure c implemented and therefore most portable.

I want to code the algorithm into a custom version of Lua to make it support reference counting.

And I'm already working on it now (based on Lua 5.4).

The problem I've encountered is, I'm not sure where to change: I'm still learning lua, both the language and the implementation.

Would you please kindly help me to point out where I should notice while coding this algorithm?
While I haven't fully understood your project, I have some considerations.
Why not try, improve Lua 5.4, suggesting real improvements, such as this "by reference counting"?
It could also be a project, which integrates the libraries you created, directly to Lua 5.4.
Lua already has problems with fragmentation. We need everyone to adopt Lua 5.4 as soon as possible.

regards,
Ranier Vilela
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
Yes, by "reference counting" is really whatever I've in mind.

And if it's OK for others, I'm quite happy to make contributions to Lua 5.4 directly.

Since GC is already widely used and accepted, I just don't think I have the right to force others to get rid of the way of thinking in GC.

So whatever I do now is: provide a switch for users to use GC or disable it (then use reference counting, and default is GC enabled).

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).

Could anyone help me to point out the most important places?

I think this would save a lot of time finding that places among code lines.



BR,
Yilin



From: Ranier Vilela <[hidden email]>
Sent: Tuesday, October 6, 2020 1:13 PM
To: Lua mailing list <[hidden email]>
Subject: Re: I need some help on some ideas
 
Em ter., 6 de out. de 2020 às 07:14, [hidden email] <[hidden email]> escreveu:
Hi dear lua list members,

About 2 months ago, I started working on a new algorithm for c++ to do memory management by reference counting algorithm.
That project was successfully completed.

Later, I was seeking for another use case, and then I found Lua.
Lua is small and elegant, pure c implemented and therefore most portable.

I want to code the algorithm into a custom version of Lua to make it support reference counting.

And I'm already working on it now (based on Lua 5.4).

The problem I've encountered is, I'm not sure where to change: I'm still learning lua, both the language and the implementation.

Would you please kindly help me to point out where I should notice while coding this algorithm?
While I haven't fully understood your project, I have some considerations.
Why not try, improve Lua 5.4, suggesting real improvements, such as this "by reference counting"?
It could also be a project, which integrates the libraries you created, directly to Lua 5.4.
Lua already has problems with fragmentation. We need everyone to adopt Lua 5.4 as soon as possible.

regards,
Ranier Vilela
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Doug Currie
On Oct 6, 2020 at 11:00:18 AM, 逸霖 杨 <[hidden email]> wrote:
[…]

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).

You may find some hints and inspiration from https://github.com/zenkj/luarc-5.1
Disclaimer: I have never used LuaRC-5.1

e

Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
Thank you very much for this information!

BR,
Yilin

From: Doug Currie <[hidden email]>
Sent: Tuesday, October 6, 2020 3:22 PM
To: Lua mailing list <[hidden email]>
Subject: Re: I need some help on some ideas
 
On Oct 6, 2020 at 11:00:18 AM, 逸霖 杨 <[hidden email]> wrote:
[…]

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).

You may find some hints and inspiration from https://github.com/zenkj/luarc-5.1
Disclaimer: I have never used LuaRC-5.1

e

Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Ranier Vilela-2
In reply to this post by yyl_20050115@hotmail.com
Em ter., 6 de out. de 2020 às 12:01, 逸霖 杨 <[hidden email]> escreveu:
Yes, by "reference counting" is really whatever I've in mind.

And if it's OK for others, I'm quite happy to make contributions to Lua 5.4 directly.

Since GC is already widely used and accepted, I just don't think I have the right to force others to get rid of the way of thinking in GC.

So whatever I do now is: provide a switch for users to use GC or disable it (then use reference counting, and default is GC enabled).
Would it be good, show how reference counting can improve the actual garbage collector?
I'm not an expert in GC and this is a harder arena.

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).
Your idea is applicable to add reference counting for the userdata objects?

regards,
Ranier Vilela
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Joshua Jensen-2
In reply to this post by Doug Currie
LuaPlus' LUA_REFCOUNT implementation for Lua 5.1 exists at [1]. I removed it years ago in the next commit, but it is there for reference.

It shipped in a number of commercial products using the reference counting implementation [2].

There are discussions within the Lua mailing list archives about its performance and memory improvements, but you would have to search them out using 'luarc'.

-Josh


Doug Currie wrote on 10/6/2020 9:22 AM:
On Oct 6, 2020 at 11:00:18 AM, 逸霖 杨 <[hidden email]> wrote:
[…]

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).

You may find some hints and inspiration from https://github.com/zenkj/luarc-5.1
Disclaimer: I have never used LuaRC-5.1

e


Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
Thanks for information!

From: Joshua Jensen <[hidden email]>
Sent: Tuesday, October 6, 2020 4:08 PM
To: [hidden email] <[hidden email]>
Subject: Re: I need some help on some ideas
 
LuaPlus' LUA_REFCOUNT implementation for Lua 5.1 exists at [1]. I removed it years ago in the next commit, but it is there for reference.

It shipped in a number of commercial products using the reference counting implementation [2].

There are discussions within the Lua mailing list archives about its performance and memory improvements, but you would have to search them out using 'luarc'.

-Josh


Doug Currie wrote on 10/6/2020 9:22 AM:
On Oct 6, 2020 at 11:00:18 AM, 逸霖 杨 <[hidden email]> wrote:
[…]

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).

You may find some hints and inspiration from https://github.com/zenkj/luarc-5.1
Disclaimer: I have never used LuaRC-5.1

e


Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
In reply to this post by Ranier Vilela-2
Would it be good, show how reference counting can improve the actual garbage collector?
I'm not an expert in GC and this is a harder arena.

Reference Counting is another way to implement automatic memory management.
Therefore, it's not a improvement for GC. It's something else.
GC has its advantages. However, there is situation such as a smoother memory usage would need
reference counting.

Your idea is applicable to add reference counting for the userdata objects?
As I see, Userdata (not the light version) is OK for RC, just like it's OK for GC.

GCObjects can be all supported by reference counting, and other primitive typed objects has no need to be supported just like
not supported by GC.



From: Ranier Vilela <[hidden email]>
Sent: Tuesday, October 6, 2020 3:54 PM
To: Lua mailing list <[hidden email]>
Subject: Re: I need some help on some ideas
 
Em ter., 6 de out. de 2020 às 12:01, 逸霖 杨 <[hidden email]> escreveu:
Yes, by "reference counting" is really whatever I've in mind.

And if it's OK for others, I'm quite happy to make contributions to Lua 5.4 directly.

Since GC is already widely used and accepted, I just don't think I have the right to force others to get rid of the way of thinking in GC.

So whatever I do now is: provide a switch for users to use GC or disable it (then use reference counting, and default is GC enabled).
Would it be good, show how reference counting can improve the actual garbage collector?
I'm not an expert in GC and this is a harder arena.

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).
Your idea is applicable to add reference counting for the userdata objects?

regards,
Ranier Vilela
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
In reply to this post by Ranier Vilela-2
To be honest, I have to code it first then I can see the performance improvement.

There may be a possibility that the speed performance improvement is negative.
But if implemented well, users should be able to forget about the memory management totally.

BTW, circular referencing problem is the road block when we use RC most of time.
The luarc-51 project solved this problem by mixing GC and RC. GC works at the time when RC can not deal with
circular references.
In my algorithm, circular referencing problem is solved directly by RC. Therefore, GC is not needed.
I don't know if this is the improvement, but will see soon.

BR,
Yilin

From: Ranier Vilela <[hidden email]>
Sent: Tuesday, October 6, 2020 3:54 PM
To: Lua mailing list <[hidden email]>
Subject: Re: I need some help on some ideas
 
Em ter., 6 de out. de 2020 às 12:01, 逸霖 杨 <[hidden email]> escreveu:
Yes, by "reference counting" is really whatever I've in mind.

And if it's OK for others, I'm quite happy to make contributions to Lua 5.4 directly.

Since GC is already widely used and accepted, I just don't think I have the right to force others to get rid of the way of thinking in GC.

So whatever I do now is: provide a switch for users to use GC or disable it (then use reference counting, and default is GC enabled).
Would it be good, show how reference counting can improve the actual garbage collector?
I'm not an expert in GC and this is a harder arena.

I need help to get a better understanding on where to apply reference counting (where to increase reference count and where to decrease reference count).
Your idea is applicable to add reference counting for the userdata objects?

regards,
Ranier Vilela
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Eretnek Hippi Messiás
In reply to this post by yyl_20050115@hotmail.com
hi there! :)

if u have a big table, then freeing it may block for a longer while, so gc is smoother i believe... otoh, i think that rc is more lightweight both in code and in overall runtime... on the 3rd hand (lulz) circular references (probably it is a rare corner case) cant be handled by a refcount if there are things that refer each other but nothing refers them from the outer world, then the rc will wont touch it, however u can break the circle 1st (on ur own way...)

if im not mistaken, then either 5.3 or 5.4 actually has an optional rc, look after it! :)

btw, about the terminology (maybe im wrong) i believe that rc is actually a type of gc as well, but whatever :D

bests, have fun! :)

Sent with ProtonMail Secure Email.
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Eretnek Hippi Messiás
(sorry, i didnt check out ur last message before i sent mine :D )

Sent with ProtonMail Secure Email.
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

yyl_20050115@hotmail.com
In reply to this post by Eretnek Hippi Messiás
So this is why I introduce my algorithm... I mean things you mentioned... circular reference actually has a good way to be solved.

5.4 has no rc so far as I know, and 5.3 I didn't check.

I'll try, and will know how efficient.

Pls wait for my good news!

😂

Have fun too!

BR,
Yilin


From: Eretnek Hippi Messiás <[hidden email]>
Sent: Tuesday, October 6, 2020 8:00 PM
To: Lua mailing list <[hidden email]>
Subject: Re: I need some help on some ideas
 
hi there! :)

if u have a big table, then freeing it may block for a longer while, so gc is smoother i believe... otoh, i think that rc is more lightweight both in code and in overall runtime... on the 3rd hand (lulz) circular references (probably it is a rare corner case) cant be handled by a refcount if there are things that refer each other but nothing refers them from the outer world, then the rc will wont touch it, however u can break the circle 1st (on ur own way...)

if im not mistaken, then either 5.3 or 5.4 actually has an optional rc, look after it! :)

btw, about the terminology (maybe im wrong) i believe that rc is actually a type of gc as well, but whatever :D

bests, have fun! :)

Sent with ProtonMail Secure Email.
Reply | Threaded
Open this post in threaded view
|

Re: I need some help on some ideas

Robert Burke
On Wed, Oct 7, 2020 at 11:59 AM 逸霖 杨 <[hidden email]> wrote:
So this is why I introduce my algorithm... I mean things you mentioned... circular reference actually has a good way to be solved.

5.4 has no rc so far as I know, and 5.3 I didn't check.

I'll try, and will know how efficient.

Pls wait for my good news!

I think normally an algorithm that does reference counting and can also handle cycles is called a GC. I am looking forward to reading about what you make!