Posts Tagged ‘PHP’

Why people who complain won’t write documentation themselves

Tuesday, October 23rd, 2007

Summary: “Too lazy, don’t seriously care, not invested enough, or just simply can’t from the lack of programming experience. Someone else doing the documentation writing can gain a lot from the experience, but advocating someone else to do so is a lost cause.”

(more…)

Possibly Related Posts:


Object Oriented Programming Isn’t Easy

Monday, October 15th, 2007

Functional Procedural developers have it easy. Damn straight and I wonder why so many developers choose to write functions, when they can opt for more beautiful classes instead. I mean, I can’t understand why programmers opt to not torture themselves and other developers. It is easy to get functions right, all you have to do is prefix them and name them properly and you’re done.

When you start talking about encapsulation, inheritance, and polymorphism, people’s heads start to explode. People understand encapsulation, “Cool, you mean I don’t have to use globals and get to keep all of my variables in one place. WHAT? You also say that I can restrict in what people can access. Oh god, this is awesome!” People understand inheritance, “So basically, if I inherit from another object, I gain all of it protected and public properties and methods and can use them from within the child object. Ooooh. Parent -> Child relationship. Like, Mother and daughter, father and son.” Which explains why it is fairly easy to understand concept.

Where it starts to break down is “has-a” and “is-a.” To be completely honest, I have no idea what to make of the two. I’ve been failing enough times that I can get the feel of the two, but if you asked me to design something, I would just have to give you a blank stare. Doesn’t make me a bad programmer, I just think the code I write sucks. Not that it does suck, just that I should strive to never write code that looks that it again.

Is this code crap?

$result = Object::action()->find()->attribute1($value1)->attribute2($value2)->save();

There is a method named “where” that does absolutely nothing. I have a sense of humor.

Object::action()->update()
    ->attribute1($value1)->attribute2($value2)->save()
    ->attribute1($value3)->attribute2($value4)->save();

I have no idea what the pattern name is, but I know it allows chaining and that is perhaps a good thing, or something. It seems to be crap, but I can’t quite put my finger on why.

I hate Singletons too

The guy already didn’t have my attention, at first, by attacking my beloved, but the articles had good points, which I’ve expressed before. I think the issue is that programmers don’t know when to create a new object and refactor their existing object into two or more. Do they not think it would be worth the effort to create a new class or do they not understand the relationship the two would have? Or at least from what I’ve witness from awful and poor excuses for objects (it is as if the intention was to torture my mind).

The purpose of an object is to do one thing and do it well. I think everyone can grasp that concept. When you find that there are parts that don’t fit into that purpose, then naturally it should be assumed that a new object should be created. You may disagree, but whatever, anyone can understand this rule of thumb and at least it might save me from cutting myself to relieve myself from the pain of reading that person’s code.

I blame the Authors

They should be stoned, to death. I swear, the analogy of the wheel and the car means nothing to a programmer of novice status. What do cars and wheels have to do with code? The answer is nothing. Yet almost every crappy source (and I’m saying that any source that uses the car/wheel example is crap) uses it. Why? I think the way “has-a” and “is-a” was golden how I was able to become even more confused then before I started reading. The article that jump started the discussion explains the concept far better than anything I’ve read previously.

Why Can’t I?

I’m constantly on the quest to improve upon the terrible object-oriented code I write. It is really maddening how poorly it comes out. The Plan: Write awesome classes that does even awesome-er stuff. The Result: I must burn all traces of this code. Framework authors make class design patterns look easy. “Pfft. I can do that!” When I think how elegant HTML Purifier is, I weep because I can’t do the same.

The concepts of objects border on advance difficulty or at least the practice of doing them right. I’ve been wrestling with how to design a plugin model and threw away many ideas because they didn’t feel right (TDD is awesome for sensing crap by the way).

Possibly Related Posts:


Does this mean PHP projects should grow up too?

Tuesday, October 9th, 2007

The content in Joshua Eichorn post about certification and test automation has been on my mind with the development of WordPress and others. Padraic Brady has been discussing Unit Testing and test automation for a while now. With good reason, it should be part of every project.

I had to learn the hard way, but once you get into the swing of writing tests, it slowly starts to make sense. It makes a lot of sense. Something that bothered me about WordPress were regressions. WTF? Well, if there were unit tests and acceptance tests, the probability of that happening would decrease tremendously. Depending on the quality of the tests of course.

The good news is that WordPress is growing up also and has initial development of functional test automation. Shouldn’t every open source PHP project take the step forward in maturity and include the step of writing tests? Cheers for those projects that already have done this.

However, this isn’t the fault of the core developers of these projects. Writing tests may be boring and fun (I would be interested to find out why this is), but the core developers want to use their time to develop awesome and probably slightly broken features. If that is the case and users care, then I think it would be useful to write the tests instead of complaining. If not, then all is well, because users will eventually discover the bug after accessing the branches of code from a much higher level.

Cheers to any project that actually reads this post and follows through, if not already doing so. Although that outcome will most likely be coincidental, in any case. It is unlikely any project would change without user involvement.

Possibly Related Posts:


The Answer is PHP

Wednesday, August 22nd, 2007

In class, the question was asked, “What is the most popular Web Programming Language?”

(Author Note: A comment bought up the point that JavaScript is technically the most popular programming language for the Web, however the question was referring to the server side of web site development. JavaScript (EMCAScript) can technically be used in other environments, but most popular for web sites.)

I was waiting for the teacher to say ASP.NET. I didn’t get the specifics but his answer seemed to avoid a direct answer. I’m bias, every answer for the backend, is going to be PHP. However, I’m going to interpret his answer and other advice I’ve read over the years. As for the most popular, that is difficult, the statistics say that PHP is used more. I could bring the source up, however, I think being able to find a paying job would be more important.

I suppose the question was more, “If I was going to program a back end for a web site, which language should I use which would guarantee longevity?” Ten years ago, would the answer had been Perl? Perhaps. I have personally known of a web game and anime fan based sites which switched from Perl to PHP after several years of development in Perl. Nothing against Perl, but perhaps it is easier to work with PHP for web development.

The roundabout answer was probably just saying that the choice of language for any project should be carefully chosen. Going with one language, just because it is more sexy or more developers know the language might be a wrong choice. Or so I’ve heard from much smarter people. Again, I could (and perhaps should) point out a few sources.

I thought about it, for a python programmer, the choice would be Python. A C# developer, most likely would be ASP.NET. As my teacher, from his words alone, doesn’t think much of PHP. It is unlikely that he would ever recommend PHP.

I would definitely choose a language that started out with the primary focus for web development. Whether that is Ruby with Ruby On Rails, PHP, or ASP.NET framework with C# or VB.NET really has to chosen by someone intelligent enough or with the authority to make that decision.

In my humble opinion at least.

Update

Added some clarity. I like the C# class because the teacher is teaching best practices and really nailing it into developers to do programs right the first time, even if it is extra work. I’ll be writing more code in C# and posts, but I’ll never use it for web development.

Possibly Related Posts:


What is your C.R.A.P. Index?

Sunday, August 5th, 2007

The upcoming 3.2 release will include software metrics, one of which is Cyclomatic Complexity. Cyclomatic Complexity is used in finding the C.R.A.P. index of a method. The Change Risk Analysis and Predictions (CRAP) index is to give some idea how difficult it would be to maintain the code base. It is not to be used in evaluating how “beautiful” the code is.

Crap Index

I’m handling entire files and functions, which PHPUnit does not support, I had to port PHPUnit’s code to allow for this. Note, with some tests, it appears that using the Change Risk Analysis and Predictions (CRAP) index on an entire file does not give expected results. During tests with 0 code coverage, scored better than with 30% code coverage. It also appears, that ironically, I needed to unit test the below functions.

Once a file closes on 100% code coverage, the results are better. However, the C.R.A.P index is going to be worse until then. So this gives us the following table.

0%: Good
1% through 94%: Bad
95%+: Better

This gives a bad impression of Unit Tests for entire files (which unit tests aren’t meant for in the first place, nor is the CRAP index for that matter). 30% code coverage would appear to be worse than having 0%, when it is in fact still better.

I would assume this means that if you don’t have any code coverage then you assume the worse, when testing for bugs. If you have some code coverage, a new developer might then assume that the unit tests cover everything and blindly expect that if something breaks, that it would be covered. If there is ~100% code coverage, then it can be expected that bugs not covered will be a smaller amount and a new developer can expect that most changes will be covered.

What is Your C.R.A.P. Index?

I’m going to use WordPress as an example for testing entire files. It would be interesting if PHPUnit added Change Risk Analysis and Predictions as an metric for methods, when it was finished and stabilized. At least it wouldn’t be difficult to add it.

I thought it would be interesting to test S9Y for a comparsion, but since it doesn’t include any unit tests, I’m not.

Code

/**
 * Based off of http://www.artima.com/weblogs/viewpost.jsp?thread=210575
 * comp(m) = cyclomatic complexity
 * cov(m) = code coverage
 *
 * C.R.A.P. Level is based off of the file and not the method.
 */
function getCrapIndex($cyclomatic_complexity, $code_coverage)
{

    if($code_coverage == 0)
    {
        // comp(m)^2 + comp(m)
        if(function_exists('gmp_pow'))
        {
            return gmp_pow($cyclomatic_complexity, 2) + $cyclomatic_complexity;
        }
        else if(function_exists('bcpow'))
        {
            return bcpow($cyclomatic_complexity, 2) + $cyclomatic_complexity;
        }
        else
        {
            return pow($cyclomatic_complexity, 2) + $cyclomatic_complexity;
        }
    }
    else if($code_coverage >= 95)
    {
        // comp(m)
        return $cyclomatic_complexity;
    }
    else
    {
        // comp(m)^2 * (1 – cov(m)/100)^3 + comp(m)
        if(function_exists('gmp_pow'))
        {
            return gmp_mul( gmp_pow($cyclomatic_complexity, 2), ( gmp_pow( ( gmp_sub(1, $code_coverage/100) ), 3) + $cyclomatic_complexity ) );
        }
        else if(function_exists('bcpow'))
        {
            return bcmul( bcpow($cyclomatic_complexity, 2), ( bcpow( ( bcsub(1, $code_coverage/100) ), 3) + $cyclomatic_complexity ) );
        }
        else
        {
            return pow($cyclomatic_complexity, 2) * (pow(1-$code_coverage/100, 3) + $cyclomatic_complexity);
        }

    }

}

The above finds the Change Risk Analysis and Predictions (CRAP) index. The crap index reduces when the code coverage is 0% or 100%. Since it is easier and quicker, I added it in based on the web site. The last one uses BCMath, for fairness and accuracy. If you don’t have BCMath extension, then it is

$crapLevel = pow($cyclomatic_complexity, 2) * (pow(1-$code_coverage/100, 3) + $cyclomatic_complexity);
// Ported from PHPUnit
// http://www.phpunit.de/browser/phpunit/branches/4.0/PHPUnit/Util/Metrics/Method.php
function getCCLevel($file)
{
    $tokens = token_get_all(file_get_contents($file));

    $ccn = 1;

    foreach ($tokens as $i => $token) {
        if (is_string($token)) {
            continue;
        } 

        list ($token, $value) = $token; 

        switch ($token)
        {
            case T_IF:
            case T_FOR:
            case T_FOREACH:
            case T_WHILE:
            case T_CASE:
            case T_CATCH:
            case T_BOOLEAN_AND:
            case T_LOGICAL_AND:
            case T_BOOLEAN_OR:
            case T_LOGICAL_OR:
                {
                    $ccn++;
                }
                break;
        }
    }

    return $ccn;
}

As you can see, the only difference between PHPUnit and my function getCCLevel() is that I’m inserting the entire file.

WordPress Crap Index By File

With 0% code coverage.

The files with CRAP index of 2 are files that include other files and only have a single if statement for including wp-settings.php. Some files, such as xmlrpc.php has internal functions and classes which would have to be removed for unit testing to provide the whole picture.

A lot of the WordPress root directory files and wp-admin directory files has presentation and business logic coupled. Because of this, the numbers are even more skewed. wp-admin files weren’t included because of this. Most developers shouldn’t mess with the wp-admin files.

WordPress includes enough hooks to where most developers won’t be required to modify the core of WordPress, so these numbers mean nothing to plugin developers. The only exception, perhaps, are the undocumented hooks and filters, that would have to be tracked down. In which case, these numbers will paint a pretty good picture of the difficulty.

As with any metric, take what you will from them, but don’t take them as a serious indicator. The Change Risk Analysis and Predictions is meant for methods (and probably functions also), so these are just for fun and shouldn’t be (mis)used against WordPress as a whole.

The colors mean nothing and just for making the numbers look pretty.

Base of WordPress

C.R.A.P. File
2 index.php
2 license.txt
2 readme.html
2 wp-register.php
2 wp-config-sample.php
6 wp-atom.php
6 wp-commentsrss2.php
6 wp-pass.php
6 wp-rdf.php
6 wp-rss.php
6 wp-rss2.php
6 wp-feed.php
20 wp-blog-header.php
90 wp-links-opml.php
110 wp-cron.php
182 wp-comments-post.php
306 wp-trackback.php
702 wp-mail.php
2970 wp-settings.php
3660 wp-login.php
20,022 wp-app.php
39,006 xmlrpc.php

WordPress Includes

C.R.A.P. File
2 version.php
2 rss-functions.php
2 registration-functions.php
6 default-filters.php
12 feed-rss.php
20 feed-atom.php
20 feed-rdf.php
20 feed-rss2.php
30 locale.php
56 feed-rss2-comments.php
72 feed-atom-comments.php
72 vars.php
90 streams.php
210 l10n.php
380 compat.php
462 registration.php
600 category.php
600 plugin.php
650 feed.php
702 author-template.php
812 bookmark.php
1260 deprecated.php
1260 user.php
1332 cron.php
1560 gettext.php
1560 template-loader.php
1722 wp-db.php
1722 comment-template.php
2550 kses.php
2756 script-loader.php
3306 bookmark-template.php
4422 cache.php
4830 capabilities.php
5112 category-template.php
5852 post-template.php
6806 class-pop3.php
6806 theme.php
7832 link-template.php
9702 class-smtp.php
11990 pluggable.php
11990 rewrite.php
12210 formatting.php
14520 class-IXR.php
15006 rss.php
16770 comment.php
17556 class-phpmailer.php
20306 classes.php
24492 widgets.php
28730 taxonomy.php
28730 general-template.php
37442 class-snoopy.php
41006 functions.php
66306 query.php
95790 post.php

Total Crap Level: 598398

Sources

1. http://www.artima.com/weblogs/viewpost.jsp?thread=210575
2. WordPress Subversion Repository.

Possibly Related Posts:


On PHP 5 Adoption

Sunday, July 15th, 2007

Matt brings up some good points. What might be limiting PHP 5 adoption, could just be the lack of interest in developers. The reason or cause for this, in my opinion might be arrogance and also ignorance. Not to put off developers, because I’m damn sure Matt is a better developer than I am.

Up until reading his rant, I’ve lived in a box where everyone I’ve talked to, used and enjoyed PHP 5 and its vast extensions. Developing in PHP 5.0 was uneventfully, but you learn to appreciate PHP 5 with the core inclusion of PDO with PHP 5.1. PHP 5 is not without annoyances. In the core developers attempts to “better” the language, they made changes that broke code that previously worked.

Extensions

With the core inclusion of JSON and improved DateTime extensions in PHP 5.2, I think a lot more people will enjoy working with PHP again. It does bring up some thoughts. The experienced programmers already know how to handle time zones in PHP 4, therefore the ease in 5.2 (and 5.1 with a little bit more code) might not impress them much. For an inexperience programmer, the feature of handling time zones might not be an concern and even then, the ease to an intermediate developer, might be too difficult to an novice.

/* $user_time_zone is based off a database table field
 * which stores the information or a cookie which any
 * user can change.
 * If you are even more brave, you can try Geocoding
 * to get the timezone.
 */
date_default_timezone_set($user_time_zone);

Now with any date() or strtotime() call, it will return the time based on the above call. PHP 5.2 makes it even easier to based calls with the DateTime and DateTimeZone objects. Word of warning, they don’t work with 5.1.

The specification of JSON is not difficult, so if you know the format of the string, it is possible to workaround not having the JSON extension. However, I think JSON extension would make any change easier, since you just pass the date to the function. It is probably the easiest of any extension, including probably the Filter extension.

The Filter extension, if security is in the mind of the developer to switch to supporting PHP 5.2.

Who cares about Dedicated?

Dedicated servers don’t matter with the adoption. The discussion should be with shared hosts. The reason is that you have complete control over PHP version, extensions, and well, everything. Those are shared hosts, unless with a host that allows you to install your own version of PHP (which isn’t very many), you have no control besides what they give you in the control panel. You might be able to switch between PHP 4 and PHP 5, but you have no control how PHP is installed, what ini options are set, or what extensions are installed.

That said, I would only count servers that are shared. I would place dedicated along side with developers who choose to support PHP 4, for whatever their reason.

PHP 4 Works

I acknowledge that there are reasons why a developer codes with PHP 4 in mind. WordPress can’t just kick out a large majority of its users by forcing the issue. I do think that many would be willing to upgrade to PHP 5, if they asked.

PHP 4 isn’t so flawed that I would shy away from coding with it. It has most of everything I work with, but I do still find some workarounds time consuming for writing functionality already in PHP 5.

It is just that moving forward, a lot of code dependent on the PHP 4 paradigm isn’t going to work with PHP 6. While I don’t want to write FUD, because most code will work with PHP 6, Register Globals is not.

Register Globals is the Problem

It is more than once that the solution for Register Globals (RG) was to downgrade from PHP 5 or not upgrade to PHP 5. Instead of working on not requiring Register Globals, applications require it. Some are pretty popular or useful enough that many would keep their PHP 4 version. PHP 5 still has Register Globals, unlike PHP 6, but has it disabled. Perhaps it is easier to require PHP 4, than to say how to enable it on PHP 5. Although some shared hosts do enable it, it can’t be counted for every host.

Those developers who don’t want to move forward and instead want to rely on Register Globals, whether because it is easier or because it would take far to long to convert code over from using it. With as many security implications made with Register Globals, I wouldn’t want to use any application that uses it. Recently, I think the choice would be difficult to do without.

Given the choice of paying $80+ on an application that doesn’t require RG or converting a full featured free application that does, which would be worth it? It would take more than a day and it would be unlikely that I’ll have the time to do so.

Something to Love in PHP 5

With as many additions, non-believers will have any something to love about PHP 5. If not PDO, than DOM (which I truly enjoy and use a great deal), or SimpleXML, or XML(Reader|Writer). With as many XML extensions, if you can’t find one easy way, then there would be another not so easy way.

Non-believers should do more research on what PHP 5 can do, because nothing I say here is going to convince anyone otherwise.

Note about Iterators and SPL

Matt remarks that there isn’t enough documentation on Iterators or enough practical use examples. That is incorrect. For every instance you pass an Array to the user for iterating with a foreach loop, you could just pass the object instead. There is enough unofficial documentation on Iterators out there, that I’m sure anyone can find some use for it in WordPress or any application.

Possibly Related Posts:


Stop Doing Email Validation the Wrong Way

Wednesday, July 11th, 2007

How do you know you are doing it wrong?

  • Are you checking the length of the email? Is it less than 128 character? Is it less than 319 characters?
  • Is the regular expression for email validation written by you?
  • Is said regular expression from php.net or this site?
  • Does the regular expression conform to the RFC for email?
  • Do you not know what RFC stands for?
  • Do you expect that your email validation will predict a real address you can send emails to?

If you answered yes to any of these, then please stop, you are doing it wrong.

Besides a generic test case that makes sure that there is a ‘@’ and a ‘.’ with text around the two, I’m really not concerned with the rest. What I’m concerned with is if I can send emails to the user without them bouncing back.

Testing Length

I think it is more deciding how many users you are going to support and how many you are going to give the finger to. “I don’t support edge cases,” or “I don’t support the 1% that will fail.” Given the disadvantages of development, I’ll say the more I support, the less fudge the numbers will be. Given the goal should be support for all users, not supporting possible edge cases, doesn’t seem like a good idea.

How many email address will be more than 40 characters in length? More than you would think. How many would be more than 64 characters? Not a lot, but doesn’t take in account Unicode.

Quote from Wikipedia Email Address, “…local-part of an e-mail address has a maximum of 64 characters … and the domain name a maximum of 255 characters.”

So 255 characters sound about right to you? Seeing as that is the maximum for MySQL VARCHAR and I doubt any domain is going to be 255 characters, unless it has a lot of subdomains or long subdomains.

Addendum
ICANN limits domain names length to 63 characters. While the wiki article probably isn’t wrong, since ICANN does impose the limit, it should be expected that all registrars are going to follow that rule. Therefore the max length would be around 140 to 150 to allow for future character length.

Update

The rest is for the subdomain(s), thanks JT Wenting.

Regular Expressions

Sigh, there are still some sites that won’t let me use ‘+’ in my email address. It is a valid character for the local part. There are many other characters that I should be able to use, but cannot. It is an injustice and a travesty against all that is “Request For Comments!” That said, I have yet to develop a regular expression that correct validates against the RFC.

Half assed seems to work just fine for all emails even ones with invalid characters. I think it might be easier just to check to see if the email has invalid characters than to test to see if it has valid characters.

Update

The purpose of this post is only to say that developers should be liberal with input where security compromises won’t be imposed. With the case of email, to be too conservative would to block too many people (which I consider myself too many people, and mostly one person would also be too many), as is seen with too many DAMNED web sites. Too many of which I can’t tell to kiss my ass.

In the case of security, okay, we are talking about email here! If they can hack your site because of inputting an email address, then there are other issues involved.

It also seems that everyone has their own email validation method. “You’re probably not a developer if you haven’t reinvented the wheel.” It is frustrating seeing pointless email validation, which are incomplete and wrong most of the time. It is even more frustrating, that these are highly talented, intelligent programmers making these small mistakes. Ironic, that they can create a complete complex system, but fail to realize the simple things (whereas, I realize the simple things, but fail with complex systems).

Possibly Related Posts:


Constantly Refactoring

Thursday, July 5th, 2007

Frequent refactoring can save time and processing in the long run. Once a function, method, or class becomes too long, then it is time to split it up into smaller pieces. By doing so, you create a library which can be reused over and over again, instead of rewriting the same functionality in multiple functions, methods, or classes.

I am finding that there are disadvantages, but I firmly believe that by breaking large components into smaller ones serves the better good. It does increase the time of development and documentation is even more important to keep track of where every piece went. To demonstrate, I’ll discuss recent projects and what I learned.

Read on if you are interested.
(more…)

Possibly Related Posts:


Joy of Conferences

Thursday, May 17th, 2007

Oh how I would love to to go to a conference. It was interesting to me at least, because I’ve been thinking about this for several weeks now. If I’m going to pay that much money, you’ll be damn sure I’m going to see as many presentations as I can. The real gem however, is networking with highly intelligent people and not so highly intelligent, but highly talented people.

How many motivated, talented PHP and other programmers exist that don’t have a blog, but still chill out at conferences? My point exactly. I think it would be fascinating to walk and talk candidly with far more skilled developers and programmers than myself. It is just really awesome to talk with someone and they actually understand what you are saying but also can coherently reply. While conservations won’t teach you much, it will open up the path to further research.

No telling how many times I said something only to stop myself when I remembered that the statement was false or the other person’s statement was false. Not everyone can produce a seamless flow of dialogue and remember every tiny detail of resources that support with evidence the statements. I do think every conversation I’ve had was enjoyable, if only for the simple fact that I was able to express knowledge that I don’t normally have a chance to.

The next person you talk to might just work with you or might just hire you. Who knows, that person you exchanged numbers with, might just call you to give you a heads up on a job opening. Might serve as a reference or might become a long time Internet and/or person friend.

Every opportunity to pimp yourself as a professional should be engaged and harnessed to its full potential. If I learned anything within the past few months is to jump on to any opening, even if you don’t think you’ll get it.

Of course, I’ve been wanting to go to a developers conference since 2002 and I think it would be far more entertaining and a rewarding educational experience to go to a game developer conference. Still any conference would be both rewarding and entertaining given the diverse population of people exhibited there.

Possibly Related Posts:


In Response to JIT Compilation

Thursday, April 26th, 2007

I understand now or at least a little bit more why JIT compilation wouldn’t be useful.

Most pages will take less than a second to execute. Caching, where possible, will also be used to further decrease the time. Opcode Caches can also be used to keep PHP from compiling the page with each request further decreasing the time it takes. Taken all together most professional web sites wouldn’t benefit from JIT compilation. Given the delay from converting to machine code, it might actually take longer on the first run.

Would it be quicker to write a C extension for PHP than building a JIT compiler for the Zend Engine? Yes. In the discussion with Frameworks, the solution is to write the slow PHP code in C and write a function to be called in PHP, if available. My argument has always been that I shouldn’t have to. If it is just as fast using JIT compilation than I shouldn’t have to touch C code unless I’m binding some library in C or C++ to be used in PHP.

Yeah, 2x time decrease (Roadsend compiler statistics) doesn’t sound like much, but I would like to run algorithms that normally take 15 to 30 seconds in half the time. That to me is a huge deal. Now, these algorithms won’t run in front end pages, of course, but I would like to maintain the code in PHP. The possibility of the algorithm being poor is there, and so is that it would be better writing the code in C/C++.

Well, what I’m trying to get at, is that with edge cases JIT compilation would make a lot of sense. For those with normal pages, then I concede that you are correct.

Possibly Related Posts: