[issue28158] Implement LOAD_GLOBAL opcode cache

2019-12-25 Thread Inada Naoki


Inada Naoki  added the comment:

This is implemented in #26219.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-12-20 Thread INADA Naoki

INADA Naoki added the comment:

memo: http://bugs.python.org/issue26219 may be relating to this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-12-19 Thread INADA Naoki

INADA Naoki added the comment:

>  Actually, if you don't mind, I'd like to update the patch myself. I have a 
> few ideas how to restructure it and add support for LOAD_ATTR.

Sounds interesting.
I'll wait to touch this patch.  There are enough time by Python 3.7
and enough other issues I can work.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-12-19 Thread Yury Selivanov

Yury Selivanov added the comment:

> As far as I look quickly, #10401 uses namei as cache key
and this patch uses opcode index as cache key, am I right?

Correct.  Actually, if you don't mind, I'd like to update the patch myself. I 
have a few ideas how to restructure it and add support for LOAD_ATTR.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-12-19 Thread INADA Naoki

INADA Naoki added the comment:

I'll update this patch and #10401 and then run benchmark suite when I have time.

As far as I look quickly, #10401 uses namei as cache key
and this patch uses opcode index as cache key, am I right?

--
nosy: +inada.naoki
priority: critical -> normal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-16 Thread Antti Haapala

Antti Haapala added the comment:

I wouldn't actually consider the builtin lookup speed almost at all, in all 
non-trivial applications the ratio of builtins to any other names will 
diminish; and if there is a tight loop, it is possible to always speed it up by 
`min = min` if you do not need to support monkey patching.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is too much magic in ceval_cache.h. Since the patch adds caching only for 
the LOAD_GLOBAL opcode, it would much clearer if write functions only for the 
LOAD_GLOBAL opcode, without multilayer macros.

What will happen if there more than 255 LOAD_GLOBALs. Wouldn't 256th 
LOAD_GLOBAL return incorrect cached value for the the LOAD_GLOBAL (with index 
0)?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread STINNER Victor

STINNER Victor added the comment:

Can you please post results of the performance benchmark suite?

If you give me more time, I can review the patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread Yury Selivanov

Yury Selivanov added the comment:

I'm going to commit this patch tomorrow.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread Yury Selivanov

Yury Selivanov added the comment:

Serhiy, feel free to review the patch.  Guido and Ned okayed it to be committed 
before 3.6b2.

Currently the patch only optimizes one opcode -- LOAD_GLOBAL, but cveal_cache.h 
file provides the infrastructure to easily implement more opcode caches.  I can 
simplify that file (remove all macros) if it's too hard to review it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread Yury Selivanov

Yury Selivanov added the comment:

> Does this prolongate the lifetime of cached global objects?

No.  I store borrowed references.  The idea is that if the state of 
globals/builtins dict has changed, we invalidate the cache.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does this prolongate the lifetime of cached global objects?

--
nosy: +serhiy.storchaka
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-15 Thread Antti Haapala

Antti Haapala added the comment:

I just noticed that you're actually testing a builtin instead of something in 
just module globals. How is the performance with module globals?

--
nosy: +ztane

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-14 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-14 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28158] Implement LOAD_GLOBAL opcode cache

2016-09-14 Thread Yury Selivanov

New submission from Yury Selivanov:

The attached patch implements an opcode cache for LOAD_GLOBAL opcode, making it 
2x faster.

The idea is to use the new co_extra field of code objects & PEP 509 to attach a 
cache structure pointing directly to the resolved global name.  When globals or 
builtins are updated, the cache is invalidated.

The patch adds a new file "ceval_cache.h" which provides some infrastructure to 
ease the pain of implementing new caches for other opcode types.  I can strip 
down all macros from that file if Victor finds it too hard to review.

Here's a simple script I used to make sure that the cache is working: 
https://gist.github.com/1st1/a9660aabdcf6b8bc6205b9fe39a82bba

You can also set OPCACHE_COLLECT_STATS to 1 to get debug stats output for the 
cache.

--
assignee: yselivanov
components: Interpreter Core
files: load_globals_cache.patch
keywords: patch
messages: 276485
nosy: gvanrossum, haypo, yselivanov
priority: critical
severity: normal
stage: patch review
status: open
title: Implement LOAD_GLOBAL opcode cache
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file44668/load_globals_cache.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com