Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
04f2b453
Kaydet (Commit)
04f2b453
authored
Ock 18, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Version 1.1. Fix memory leak and expensive comparison with None.
üst
3e7ae7ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
pystone.py
Lib/test/pystone.py
+22
-3
pystone.py
Tools/scripts/pystone.py
+22
-3
No files found.
Lib/test/pystone.py
Dosyayı görüntüle @
04f2b453
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"""
"""
"PYSTONE" Benchmark Program
"PYSTONE" Benchmark Program
Version: Python/1.
0 (corresponds to C/1.1
)
Version: Python/1.
1 (corresponds to C/1.1 plus 2 Pystone fixes
)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
...
@@ -12,13 +12,31 @@ Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
...
@@ -12,13 +12,31 @@ Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
at the expense of C-ness.
at the expense of C-ness.
Translated from C to Python by Guido van Rossum.
Translated from C to Python by Guido van Rossum.
Version History:
Version 1.1 corrects two bugs in version 1.0:
First, it leaked memory: in Proc1(), NextRecord ends
up having a pointer to itself. I have corrected this
by zapping NextRecord.PtrComp at the end of Proc1().
Second, Proc3() used the operator != to compare a
record to None. This is rather inefficient and not
true to the intention of the original benchmark (where
a pointer comparison to None is intended; the !=
operator attempts to find a method __cmp__ to do value
comparison of the record). Version 1.1 runs 5-10
percent faster than version 1.0, so benchmark figures
of different versions can't be compared directly.
"""
"""
LOOPS
=
1000
LOOPS
=
1000
from
time
import
clock
from
time
import
clock
__version__
=
"1.
0
"
__version__
=
"1.
1
"
[
Ident1
,
Ident2
,
Ident3
,
Ident4
,
Ident5
]
=
range
(
1
,
6
)
[
Ident1
,
Ident2
,
Ident3
,
Ident4
,
Ident5
]
=
range
(
1
,
6
)
...
@@ -121,6 +139,7 @@ def Proc1(PtrParIn):
...
@@ -121,6 +139,7 @@ def Proc1(PtrParIn):
NextRecord
.
IntComp
=
Proc7
(
NextRecord
.
IntComp
,
10
)
NextRecord
.
IntComp
=
Proc7
(
NextRecord
.
IntComp
,
10
)
else
:
else
:
PtrParIn
=
NextRecord
.
copy
()
PtrParIn
=
NextRecord
.
copy
()
NextRecord
.
PtrComp
=
None
return
PtrParIn
return
PtrParIn
def
Proc2
(
IntParIO
):
def
Proc2
(
IntParIO
):
...
@@ -137,7 +156,7 @@ def Proc2(IntParIO):
...
@@ -137,7 +156,7 @@ def Proc2(IntParIO):
def
Proc3
(
PtrParOut
):
def
Proc3
(
PtrParOut
):
global
IntGlob
global
IntGlob
if
PtrGlb
!=
None
:
if
PtrGlb
is
not
None
:
PtrParOut
=
PtrGlb
.
PtrComp
PtrParOut
=
PtrGlb
.
PtrComp
else
:
else
:
IntGlob
=
100
IntGlob
=
100
...
...
Tools/scripts/pystone.py
Dosyayı görüntüle @
04f2b453
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"""
"""
"PYSTONE" Benchmark Program
"PYSTONE" Benchmark Program
Version: Python/1.
0 (corresponds to C/1.1
)
Version: Python/1.
1 (corresponds to C/1.1 plus 2 Pystone fixes
)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
...
@@ -12,13 +12,31 @@ Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
...
@@ -12,13 +12,31 @@ Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
at the expense of C-ness.
at the expense of C-ness.
Translated from C to Python by Guido van Rossum.
Translated from C to Python by Guido van Rossum.
Version History:
Version 1.1 corrects two bugs in version 1.0:
First, it leaked memory: in Proc1(), NextRecord ends
up having a pointer to itself. I have corrected this
by zapping NextRecord.PtrComp at the end of Proc1().
Second, Proc3() used the operator != to compare a
record to None. This is rather inefficient and not
true to the intention of the original benchmark (where
a pointer comparison to None is intended; the !=
operator attempts to find a method __cmp__ to do value
comparison of the record). Version 1.1 runs 5-10
percent faster than version 1.0, so benchmark figures
of different versions can't be compared directly.
"""
"""
LOOPS
=
1000
LOOPS
=
1000
from
time
import
clock
from
time
import
clock
__version__
=
"1.
0
"
__version__
=
"1.
1
"
[
Ident1
,
Ident2
,
Ident3
,
Ident4
,
Ident5
]
=
range
(
1
,
6
)
[
Ident1
,
Ident2
,
Ident3
,
Ident4
,
Ident5
]
=
range
(
1
,
6
)
...
@@ -121,6 +139,7 @@ def Proc1(PtrParIn):
...
@@ -121,6 +139,7 @@ def Proc1(PtrParIn):
NextRecord
.
IntComp
=
Proc7
(
NextRecord
.
IntComp
,
10
)
NextRecord
.
IntComp
=
Proc7
(
NextRecord
.
IntComp
,
10
)
else
:
else
:
PtrParIn
=
NextRecord
.
copy
()
PtrParIn
=
NextRecord
.
copy
()
NextRecord
.
PtrComp
=
None
return
PtrParIn
return
PtrParIn
def
Proc2
(
IntParIO
):
def
Proc2
(
IntParIO
):
...
@@ -137,7 +156,7 @@ def Proc2(IntParIO):
...
@@ -137,7 +156,7 @@ def Proc2(IntParIO):
def
Proc3
(
PtrParOut
):
def
Proc3
(
PtrParOut
):
global
IntGlob
global
IntGlob
if
PtrGlb
!=
None
:
if
PtrGlb
is
not
None
:
PtrParOut
=
PtrGlb
.
PtrComp
PtrParOut
=
PtrGlb
.
PtrComp
else
:
else
:
IntGlob
=
100
IntGlob
=
100
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment