Command-line editor unexpectedly memorable

2019-02-08 Thread Johannes Hielscher
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Chet Ramey
On 2/8/19 12:39 PM, Eric Blake wrote: > On 2/8/19 11:26 AM, Peng Yu wrote: > >>> Come on. If you're not going to read the code, at least read the comments. >> >> This is what I don't understand. Why caching pointers not caching the >> actual memory allocated to the string can improve the performan

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Eric Blake
On 2/8/19 11:26 AM, Peng Yu wrote: >> Come on. If you're not going to read the code, at least read the comments. > > This is what I don't understand. Why caching pointers not caching the > actual memory allocated to the string can improve the performance? > >> /* Create an object cache C of N po

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Peng Yu
On Fri, Feb 8, 2019 at 10:50 AM Chet Ramey wrote: > > On 2/8/19 10:52 AM, Peng Yu wrote: > > On Fri, Feb 8, 2019 at 9:42 AM Chet Ramey wrote: > >> > >> On 2/8/19 10:39 AM, Peng Yu wrote: > Yes: ocache_free. > >>> > >>> Could you please help explain what wdcache and wlcache actually do. > >>>

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Chet Ramey
On 2/8/19 10:52 AM, Peng Yu wrote: > On Fri, Feb 8, 2019 at 9:42 AM Chet Ramey wrote: >> >> On 2/8/19 10:39 AM, Peng Yu wrote: Yes: ocache_free. >>> >>> Could you please help explain what wdcache and wlcache actually do. >>> Why is it essential to have them? Why not just alloc and free them >

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Peng Yu
On Fri, Feb 8, 2019 at 9:42 AM Chet Ramey wrote: > > On 2/8/19 10:39 AM, Peng Yu wrote: > >> Yes: ocache_free. > > > > Could you please help explain what wdcache and wlcache actually do. > > Why is it essential to have them? Why not just alloc and free them > > without the caches? Thanks. > > To a

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Chet Ramey
On 2/8/19 10:39 AM, Peng Yu wrote: >> Yes: ocache_free. > > Could you please help explain what wdcache and wlcache actually do. > Why is it essential to have them? Why not just alloc and free them > without the caches? Thanks. To avoid potentially-expensive calls to malloc and free, the same as a

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Peng Yu
> Yes: ocache_free. Could you please help explain what wdcache and wlcache actually do. Why is it essential to have them? Why not just alloc and free them without the caches? Thanks. -- Regards, Peng

Re: What is the purpose of wdcache and wlcache?

2019-02-08 Thread Chet Ramey
On 2/7/19 11:43 PM, Peng Yu wrote: > Hi, > > I don't understand the purpose of wdcache and wlcache. The "nc" field > seems to be always 0 (as initialized in ocache_create(), and I don't > find where it is increased. But `ocache_alloc()` just call xmalloc > without using the cache since nc is 0. So