<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: RUST’ED, GO’LANG WITH PYTHON in Software - General</title>
    <link>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7208816#M989</link>
    <description>&lt;P&gt;Hi, nice to read about Rust here, thanks for your post.&lt;/P&gt;&lt;P&gt;Only one thing about performance test. Rust println implementation is focused in memory efficiency instead of raw performance. It means that it doesn't use any kind of buffer (like Golang and Pyton do) to avoid memory allocations. Look, I have test your code and got:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://i.imgur.com/k1iwS82.png[/img]" border="0" alt="no buffer" width="269" height="412" /&gt;&lt;/P&gt;&lt;P&gt;47 segs&lt;/P&gt;&lt;P&gt;Then I have added a buffer (like golang and pyton) to the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;use std::io::stdin;
use std::time::Instant;
use std::io::stdout;
use std::io::BufWriter;
use std::mem::drop;
use std::io::Write;

fn main() {
    let lock = stdout().lock();
    let mut writer = BufWriter::new(lock);
    
    let start = Instant::now();
    for index in 0..1000000 {
        writer.write(index.to_string().as_bytes()).expect("STDOUT closed");
        writer.write(b"\n").expect("STDOUT closed");
    }

    drop(writer);
    let duration = start.elapsed();

    println!("Time: {:?}", duration);
    let mut input = String::new();
    stdin().read_line(&amp;amp;mut input).expect("Failed to read line");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and test it again:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://i.imgur.com/gU2Q6iM.png" border="0" alt="buffer" width="339" height="483" /&gt;&lt;/P&gt;&lt;P&gt;7.6 seconds almost 7 times faster &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;BR /&gt;&lt;BR /&gt;In Rust this low level things have to be considered, it gives you much more control than mainstream languages.&lt;BR /&gt;This additional complexity gives you C++ like performance and efficiency, and the best for me, null safety and mandatory error handling (if u avoid unwrap), which is totally game changer in terms of software quality.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 09:19:30 GMT</pubDate>
    <dc:creator>Rustaceo</dc:creator>
    <dc:date>2024-09-16T09:19:30Z</dc:date>
    <item>
      <title>RUST’ED, GO’LANG WITH PYTHON</title>
      <link>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7208278#M979</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva" size="5"&gt;Python enthusiasts it’s for you! &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;This article targets developers, programmers, or individuals proficient in Python who have experience with related programming languages like Golang and Rust, developed by Google and Mozilla, respectively. Python, Golang, and Rust are widely recognized among developers for their advanced features such as parallelism, concurrency, efficiency, memory safety, and performance, which have contributed to their popularity within the programming community.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva"&gt;Scope:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;The purpose of this article isn't to contrast the features, merits, and drawbacks of these languages. Rather, it serves as a quick glimpse into how developers can employ these programming languages to suit the needs of a particular project. The insights provided below stem from extensive programming expertise and understanding.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;What is it about?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Python is simple and have huge collection of libraries and frameworks, whereas Golang and Rust have an ancestor called C and C++.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Rust and Go programs extremely fast in comparison to interpreted languages such as Python.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva"&gt;More on Python:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;Python, an open-source scripting language, enjoys widespread popularity and continuous growth due to its seamless integration with numerous applications and databases. It has become the top choice for students and beginner coders, thanks to its clear, concise syntax reminiscent of natural language. This simplicity makes Python significantly easier to learn compared to other programming languages.&lt;/FONT&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;Its ease of comprehension is particularly crucial in the realm of Artificial Intelligence and Machine Learning (AI &amp;amp; ML), where programmers grapple with intricate algorithms and data manipulation. Python boasts an extensive ecosystem of libraries and frameworks across all platforms, including APIs, AI, and ML. These libraries offer ready-made functions and tools for swift and effortless execution of common tasks, featuring renowned ones like NumPy, Pandas, Scikit-learn, Boto3, TensorFlow, and PyTorch.&lt;/FONT&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;Python's flexibility extends from basic tasks to the development of complex deep learning models, making it a versatile programming language.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva" size="3"&gt;&lt;FONT face="verdana,geneva"&gt;Rust:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Rust, on the other hand, stands as a low-level, multi-paradigm programming language emphasizing safety and performance. Developed by Mozilla, Rust prioritizes execution speed by making specific design trade-offs. Its focus on safety is evident through features like the borrow checker, aimed at eliminating runtime bugs. &amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Utilizing zero-cost abstractions and an ownership model, Rust ensures memory safety without relying on garbage collection. Its type system plays a crucial role in safety, eliminating null pointers to mitigate null reference errors—a significant advantage as null pointers are a notorious source of bugs.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva"&gt;Go:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Go is an open-source programming language that makes it easy to build simple, reliable, and efficient software. It is more concerned with simplicity. Go provides a superb built-in unit testing framework. Go has features like garbage collection, and automatic memory management which make it quick and easy to develop reliable, efficient programs.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Go’s explicit error checking uses the built-in error type where functions return errors as one of the return values. Go also has a built-in race detector that helps identify and fix race conditions in concurrent applications, contributing to its security profile. Race conditions occur when multiple threads access shared resources at the same instance, and one of the threads modifies the data.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva" size="3"&gt;Case Study:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;The following case study was conducted to analyze the metrics and performance of various scripting languages. It involves a basic loop that iterates and prints to the terminal one million times. Additionally, the study records the duration of the process.&lt;/FONT&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="verdana,geneva"&gt;It's important to acknowledge that the execution time may vary depending on&lt;/FONT&gt; &lt;FONT face="verdana,geneva"&gt;the system configuration.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;&lt;FONT face="verdana,geneva"&gt;Rust Execution time: 1 minute 53 seconds&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;use std::time::Instant;

fn main() {
    let start_time = Instant::now();

    for i in 1..=1000000 {
        println!("{}", i);
    }

    let duration = start_time.elapsed();
    println!("Execution time: {:?}", duration);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="verdana,geneva" size="2"&gt;Golang Execution time: 1 minute 44 seconds&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;package main

import (
    "fmt"
    "time"
)

func main() {
    startTime := time.Now()

    for i := 1; i &amp;lt;= 1000000; i++ {
        fmt.Println(i)
    }

    duration := time.Since(startTime)
    fmt.Println("Execution time:", duration)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="verdana,geneva" size="2"&gt;Python Execution time: 2 minutes&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import time

i=0

starttime=time.time()
while i&amp;lt;=1000000:
    print(i)
    i=i+1
endtime=time.time()
execution_duration=endtime-starttime
print('execution_time',round(execution_duration)/60)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva"&gt;Comparing the execution time:&lt;/FONT&gt;&amp;nbsp;&lt;/STRONG&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table.jpg" style="width: 297px;"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/140037i1DC5499EB6B748AE/image-dimensions/297x83?v=v2" width="297" height="83" role="button" title="table.jpg" alt="table.jpg" /&gt;&lt;/span&gt;&lt;FONT face="verdana,geneva"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;The above piece of program has been executed against these three scripting languages terminal and noticed that execution time of Go and Rust are better than Python.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva" size="3"&gt;Inter-programmability between scripting languages:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;It means with in these three scripting languages, anyone can borrow modules or classes. Here are some of the examples.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT face="verdana,geneva"&gt;python module in golang:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;github.com/go-python/gpython&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT face="verdana,geneva"&gt;go packages in python:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;github.com/go-python/gopy&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT face="verdana,geneva"&gt;Python embedded in Rust apps:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;github.com/Rustpython/RustPython&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT face="verdana,geneva"&gt;Rust bindings for Python:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;github.com/PyO3/pyo3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT face="verdana,geneva"&gt;calling Rust code from Go:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;github.com/mediremi/rust-plus-golang&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT face="verdana,geneva"&gt;Summary:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;There may be a different way of writing a program to solve a problem using different programming languages. At the same time, the features, usability, popularity and accessibility of a particular programming language matters. As described earlier, its developer/programmer choice to choose the scripting language and shape up the solution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;About Author:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anand Thirtha Korlahalli" style="width: 107px;"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/140039iECC160A18748C20A/image-dimensions/107x135?v=v2" width="107" height="135" role="button" title="Anand.jpg" alt="Anand Thirtha Korlahalli" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Anand Thirtha Korlahalli&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;Anand Thirtha Korlahalli works for "Infrastructure &amp;amp; Integration Services" domain as a Technology Architect,&amp;nbsp;Remote Professional Services, HPE Operations – Services Experience Delivery,&amp;nbsp;Bangalore&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 09:19:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7208278#M979</guid>
      <dc:creator>anandtk</dc:creator>
      <dc:date>2024-09-16T09:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: RUST’ED, GO’LANG WITH PYTHON</title>
      <link>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7208816#M989</link>
      <description>&lt;P&gt;Hi, nice to read about Rust here, thanks for your post.&lt;/P&gt;&lt;P&gt;Only one thing about performance test. Rust println implementation is focused in memory efficiency instead of raw performance. It means that it doesn't use any kind of buffer (like Golang and Pyton do) to avoid memory allocations. Look, I have test your code and got:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://i.imgur.com/k1iwS82.png[/img]" border="0" alt="no buffer" width="269" height="412" /&gt;&lt;/P&gt;&lt;P&gt;47 segs&lt;/P&gt;&lt;P&gt;Then I have added a buffer (like golang and pyton) to the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;use std::io::stdin;
use std::time::Instant;
use std::io::stdout;
use std::io::BufWriter;
use std::mem::drop;
use std::io::Write;

fn main() {
    let lock = stdout().lock();
    let mut writer = BufWriter::new(lock);
    
    let start = Instant::now();
    for index in 0..1000000 {
        writer.write(index.to_string().as_bytes()).expect("STDOUT closed");
        writer.write(b"\n").expect("STDOUT closed");
    }

    drop(writer);
    let duration = start.elapsed();

    println!("Time: {:?}", duration);
    let mut input = String::new();
    stdin().read_line(&amp;amp;mut input).expect("Failed to read line");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and test it again:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://i.imgur.com/gU2Q6iM.png" border="0" alt="buffer" width="339" height="483" /&gt;&lt;/P&gt;&lt;P&gt;7.6 seconds almost 7 times faster &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;BR /&gt;&lt;BR /&gt;In Rust this low level things have to be considered, it gives you much more control than mainstream languages.&lt;BR /&gt;This additional complexity gives you C++ like performance and efficiency, and the best for me, null safety and mandatory error handling (if u avoid unwrap), which is totally game changer in terms of software quality.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 09:19:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7208816#M989</guid>
      <dc:creator>Rustaceo</dc:creator>
      <dc:date>2024-09-16T09:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: RUST’ED, GO’LANG WITH PYTHON</title>
      <link>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7209626#M996</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/2272305"&gt;@Rustaceo&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;for review and sharing your valuable feedback.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 09:06:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/software-general/rust-ed-go-lang-with-python/m-p/7209626#M996</guid>
      <dc:creator>anandtk</dc:creator>
      <dc:date>2024-03-20T09:06:05Z</dc:date>
    </item>
  </channel>
</rss>

