add value.

creating a better world by free software + develop some degree of consciousness = adds value for all life on the planet.

this is what software development is all about.

whatever makes reaching this goal easier/better is welcome.

some people are angry at PHP.

While i am not angry at PHP (more at MySQL’s massively grown RAM consumption :-D) – what is great about PHP you can code together a prototype of your application very fast.

Also Webservers such as Apache2 or Nginx are okay to install but NOT easy to configure. Lighttpd is 😀 but does not support .htaccess.

The real revolution with with GO is – GO does not need a webserver software at all.

“If you are working with PHP, you’re probably asking whether or not we need something like Nginx or Apache. The answer is we don’t, since Go listens to the TCP port by itself, and the function “sayhelloName” is the logic function just like a controller in PHP.” (src)

Which is something i often thought about – why do i actually need that webserver software 😀

less software = more security and performance

but if you need .htaccess to work – you would need to code it yourself.

So this makes me very curious.

This seemed to be one of the major intentions of the Golang developers.

Write your own webserver in a language almost as fast as C – leave out a lot of overhead and setup, maintenance and configuration.

crazy or crazy like a fox? https://medium.com/@lucperkins/web-development-in-c-crazy-or-crazy-like-a-fox-ff723209f8f5

writing your own webserver in C – http://beej.us/guide/bgnet/output/html/multipage/index.html

https://www.startpage.com/do/dsearch?query=write+a+webserver+in+c&cat=web&pl=opensearch&language=deutsch

Step-Debugging your application directly on the server is a little bit complicated to setup but doable. ( i should upload my phpDev-VM 😀 … will do that as soon as this server moved to a cheaper provider that provides bigger harddisks)

If i had to prioritize what features i need most from a language i would say:

  1. step debugging 😀 (can’t live without it, doable in PHP with XDebug and Eclipse but not easy to setup)
  2. easy to learn, simplicity, fast visual results are good for motivation, rapid prototyping
  3. security
  4. software-quality and stability
  5. compile-time / easy and fast testing
    • nobody likes to sit in front of a computer and wait for things to load or compile, especially if you are performing this step several hundred times a day
    • modularity is key (have separately runnable files that you can test separately without running/compiling the whole (large) program)
    • would be really cool if you can do both – run code immediately for testing – if tests are good – compile and upload to server.
  6. performance and scalability

while – of yourse – you could access a MySQL database in PHP with a one-liner, you probably won’t because you have to handle a lot of exceptions (mysql not responding, database not found, sql query returns errors)… so you write a seperate file with 1-2-300 lines of (REUSABLE!) code – just to connect to the database.

PHP is a grown language – which means over time a lot of things were added and changed.

Following these changes/updates can be stressfull. (you might have to rewrite (usually small) parts of your old code to run on newer PHP)

With PHP7 performance has once more gained ground (have not tested by MySQL class-library-file if it run’s without grant modification on it and if performance for database-queries has increased much… WordPress for example is making havy use of database queries) – but where PHP always seemed to have problems is scalability.

real world usecease examples:

very good – https://www.iron.io/how-we-went-from-30-servers-to-2-go/

“I even find that our code is higher quality just due to the fact that it’s written in Go.

I’m not entirely sure why this is, but I get a warm and fuzzy feeling about our stuff written in Go. Perhaps it’s the very strict compiler that even forces us to remove imports and variables that aren’t in use. Perhaps it’s the small amount of code you have to write to get a lot done. Maybe I’ll figure this out and write more about it some day.”

https://www.iron.io/go-after-2-years-in-production/

not so good – https://forum.golangbridge.org/t/is-golang-good-for-real-world-web-apps/3995

concept

Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Kincaid, Jason (10 November 2009). “Google’s Go: A New Programming Language That’s Python Meets C++”. TechCrunch. Retrieved 18 January 2010.

benchmarking the alternatives:

Here are the benchmark results (2016-06)

Language CPU time Slower than Language
version
Source
code
User System Total C++ previous
C++ (optimized with -O2) 0.952 0.172 1.124 g++ 5.3.1 link
Java 8 (non-std lib) 1.332 0.096 1.428 27% 27% 1.8.0_72 link
Python 2.7 + PyPy 1.560 0.160 1.720 53% 20% PyPy 4.0.1 link
Javascript (nodejs) 1.524 0.516 2.040 81% 19% 4.2.6 link
C++ (not optimized) 2.988 0.168 3.156 181% 55% g++ 5.3.1 link
PHP 7.0 6.524 0.184 6.708 497% 113% 7.0.2 link
Java 8 14.616 0.908 15.524 1281% 131% 1.8.0_72 link
Python 3.5 18.656 0.348 19.004 1591% 22% 3.5.1 link
Python 2.7 20.776 0.336 21.112 1778% 11% 2.7.11 link
Perl 25.044 0.236 25.280 2149% 20% 5.22.1 link
PHP 5.6 66.444 2.340 68.784 6020% 172% 5.6.17 link

Brief analysis of the results:

  • NodeJS got almost 2x faster.
  • Java 8 seems almost 2x slower.
  • Python has no significant change in the performance. Every new release is a little bit faster but overall Python is steadily 15x slower than C++.
  • Perl has the same trend as Python and is steadily 22x slower than C++.
  • PHP 5.x is the slowest with results between 47x to 60x behind C++.
  • PHP 7 made the big surprise. It is about 10x faster than PHP 5.x, and about 3x faster than Python which is the next fastest script language… maybe Intel will build PHP-hardware-acceleration into their next CPU? 😀

The tests were run on a Debian Linux 64-bit machine.

You can download the source codes, an Excel results sheet, and the benchmark batch script at:
https://github.com/famzah/langs-performance

Can PHP code be compiled in a faster binary form?

https://stackoverflow.com/questions/1408417/can-you-compile-php-code

Facebook created such a thing called HipHop but then dropped it and went a more Java-Virtual-Machine-Approach: HHVM is an open-source virtual machine designed for executing programs written in Hack and PHP.

HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.

HHVM supports Hack, PHP 5 and the major features of PHP 7.

We are aware of minor incompatibilities, so please open issues when you find them. HHVM also supports many extensions as well.

http://hhvm.com/

licence

Wikipedia says it’s “Free Software” … well what is this license then?

https://github.com/golang/go – yes it is open source

https://golang.org/LICENSE?m=text

Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
   * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin