Skip to content

Optimize papi_is_empty check for arrays - #191

Merged
frozzare merged 1 commit into
wp-papi:masterfrom
rasmusbe:optimize-empty-check
Sep 10, 2016
Merged

frozzare merged 1 commit into
wp-papi:masterfrom
rasmusbe:optimize-empty-check

Conversation

@rasmusbe

@rasmusbe rasmusbe commented Sep 9, 2016

Copy link
Copy Markdown
Contributor

Description

An array is not empty if one of the values is not empty, therefore we should not loop thru the whole array if not necessary.

This change makes a huge speed improvement for papi_is_empty, in my tests from an improvement of 96%.

An array is not empty if one of the values is not empty, therfore we should not loop thru the whole array if not necessary.
@codecov-io

codecov-io commented Sep 9, 2016 •

Copy link
Copy Markdown

Current coverage is 94.93% (diff: 100%)

Merging #191 into master will increase coverage by <.01%

@@             master       #191   diff @@
==========================================
  Files            82         82          
  Lines          5213       5215     +2   
  Methods         481        481          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           4949       4951     +2   
  Misses          264        264          
  Partials          0          0          

Powered by Codecov. Last update 539a4ee...0c387fe

@frozzare
frozzare merged commit 6c6b59a into wp-papi:master Sep 10, 2016
@frozzare

Copy link
Copy Markdown
Member

Looks good, thanks!

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