Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Timsort for sorting #5559

Closed
wants to merge 2 commits into from
Closed

Use Timsort for sorting #5559

wants to merge 2 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented May 12, 2020

Just a quick test, with the implementation taken from https://github.com/patperry.

Many test failures due to differences in performed comparisons.

@nikic nikic mentioned this pull request May 12, 2020
@cmb69
Copy link
Member

cmb69 commented May 12, 2020

Fix for Windows:

 win32/build/config.w32 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 62dbeb40d9..048886e60a 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -236,7 +236,7 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
 	zend_object_handlers.c zend_objects_API.c \
 	zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c zend_weakrefs.c \
 	zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
-	zend_inheritance.c zend_smart_str.c zend_cpuinfo.c");
+	zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_timsort.c");
 
 ADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
 if (VS_TOOLSET && VCVERS >= 1914) {

*
* arraySizes minRun = cumSums (binSizes minRun)
*
* We these funcitons, we can compute a table with minRun = MIN_MERGE / 2 = 16:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We these funcitons -> With these functions ?

(the original code has the same "mistake": https://github.com/patperry/timsort/blob/9fc97ae0857e4fbce06c1b6b26b48e427e307895/timsort.c#L262)

* ],
*
* Moreover, minRun >= MIN_MERGE / 2. Also, note that the sum of the
* run lenghts is less than or equal to the length of the array.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lenghts -> lengths

@nikic nikic closed this May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants