AI编程工具Copilot与Codeium的实测对比

这篇具有很好参考价值的文章主要介绍了AI编程工具Copilot与Codeium的实测对比。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

csdn原创谢绝转载

简介

现在没有AI编程工具,效率会打一个折扣,如果还没有,赶紧装起来.

  1. GitHub Copilot是OpenAi与github等共同开发的的AI辅助编程工具,基于ChatGPT驱动,功能强大,这个没人怀疑,看它的价格就知道了,最开始是10美元1个月,后面好像涨到20美元了.
    我个人给它起了个嘴强王者的称号,就是动动嘴就能实现代码.

  2. Codeium是一款免费的Ai辅助编程工具,支持70多种编程语言,插件支持40多种编辑器.功能也挺强大的,关键免费的,
    我称赞它为白Piao党们的编程秘书.
    其他文章
    AndroidStudio上安装Codeium方法.
    Android Studio安装AI编程助手Github Copilot

环境

  1. 测试使用的是Android Studio, Codeium要在VsCode上支持对话,这里只简单对比编程的功能.
  2. 语言Java

代码对比

在同一个Android Studio上,书写相似的简单代码,得到补全代码.然后对比二者表现.
代码尽量挑选平常会用到的公共函数.

Copilot

// 作者:帅得不敢出门
public class Copilot {
    // 用递归实现斐波那契数列
    public static int fibonacci(int n) {
        if (n <= 1) return n;
        return fibonacci(n - 1) + fibonacci(n - 2);
    }

    public void writeFile(String file, String content) {
        try {
            FileWriter fw = new FileWriter(file);
            fw.write(content);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // 手动输入参数int dp后实现
    public int dp2px(int dp) {
        return (int) (dp * 3.0f + 0.5f);
    }

    // 手动输入Context参数
    public int dpToPx(Context context, int dp) {
        return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f);
    }

    // 实现获取最前端的Activity名称的函数
    // 输入上面这行,copilot无任何提示


    public String getTopActivity(Context context) {
        return context.getClass().getSimpleName();
    }

    public boolean isAppForeground(Context context, String packageName) {
        return packageName.equals(getTopActivity(context));
    }

    public boolean isAppSystem(Context context, String packageName) {
        return context.getPackageManager().getLaunchIntentForPackage(packageName) == null;
    }

    public int getStatusBarHeight(Context context) {
        int result = 0;
        int resourceId = context.getResources().getIdentifier("status_bar_height",
                "dimen", "android");
        if (resourceId > 0) result = context.getResources().getDimensionPixelSize(resourceId);
        return result;
    }

    public int getScreenWidth(Context context) {
        return context.getResources().getDisplayMetrics().widthPixels;
    }

    public String bytes2HexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (byte aByte : bytes) {
            String hex = Integer.toHexString(aByte & 0xFF);
            if (hex.length() < 2) sb.append(0);
            sb.append(hex);
        }
        return sb.toString();
    }

    public boolean isPhoneNumber(String phoneNumber) {
        return phoneNumber.matches("^1[3-9]\\d{9}$");
    }

    public String getDate() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date());
    }

    public String getCurrentTime() {
        return new SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(new Date());
    }

    public static int getTodayOfWeek() {
        return new Date().getDay();
    }

    public static int getDayOfWeek(Date date) {
        return date.getDay();
    }

    public static boolean isChinese(String str) {
        return str.matches("[\\u4e00-\\u9fa5]+");
    }

    /*
    这个会编译不过
    public boolean isScreenOn(Context context) {
        return context.getSystemService(Context.POWER_SERVICE).isScreenOn();
    }
     */

    public void setBrightness(Context context, int brightness) {
        android.provider.Settings.System.putInt(context.getContentResolver(),
                android.provider.Settings.System.SCREEN_BRIGHTNESS, brightness);
    }

    public String getAndroidId(Context context) {
        return android.provider.Settings.Secure.getString(context.getContentResolver(),
                android.provider.Settings.Secure.ANDROID_ID);
    }

}

Codeium

// 作者:帅得不敢出门
public class Codeium {
    // 用递归实现斐波那契数列
    public int fib(int n) {
        if (n == 0) {
            return 0;
        } else if (n == 1) {
            return 1;
        } else {
            return fib(n - 1) + fib(n - 2);
        }
    }

    // 输入到writeFile(会自动提示出参数及实现
    public void writeFile(String fileName, String content) {
        try {
            File file = new File(fileName);
            FileWriter fw = new FileWriter(file);
            fw.write(content);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public int dp2px(int dp) {
        return (int) (dp * 0.5f + 0.5f);
    }

    // 要手动输入Context参数
    public int dpToPx(Context context, int dp) {
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
    }

    public String getTopActivity(Context context) {
        return "com.benew.testm";
    }

    public boolean isAppForeground(Context context, String packageName) {
        return false;
    }

    public boolean isAppSystem(Context context, String packageName) {
        return packageName.equals("com.android.systemui");
    }

    public int getStatusBarHeight(Context context) {
        return 0;
    }

    // 这个要手动输入Context参数
    public int getScreenWidth(Context context) {
        return context.getResources().getDisplayMetrics().widthPixels;
    }

    public String bytes2HexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < bytes.length; i++) {
            String hex = Integer.toHexString(0xFF & bytes[i]);
            if (hex.length() == 1) {
                sb.append('0');
            }
            sb.append(hex.toUpperCase());
        }
        return sb.toString();
    }

    public boolean isPhoneNumber(String phoneNumber) {
        // 默认是提示return false
        //return false;
        // 要手动先输入phoneNumber.matches(
        return phoneNumber.matches("^[1][3,4,5,7,8][0-9]{9}$");
    }

    public String getDate() {
        return new java.text.SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date());
    }

    public String getCurrentTime(){
        return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
    }

    public static int getTodayOfWeek(){
        Calendar cal = Calendar.getInstance();
        return cal.get(Calendar.DAY_OF_WEEK);
    }

    public static int getDayOfWeek(Date date){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return cal.get(Calendar.DAY_OF_WEEK);
    }

    public static boolean isChinese(String str){
        return str.matches("[\\u4E00-\\u9FA5]+");
    }

    public boolean isScreenOn(Context context){
        return false;
    }

    public void setBrightness(Context context, int level){
        // 这里如果不主动输入codeium会无提示, 需要手动输入android.provider
        android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, level);
    }

    public String getAndroidId(Context context){
        // 这里codeium要手动输入return android.provider 才会提示, 否则会提示成return null
        return android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
    }

}

结果

代码部分对比图
AI编程工具Copilot与Codeium的实测对比,人工智能,Android平台,AI编程,copilot,android

由于工具,语言,代码量都较单一,无法以偏盖全,只是做个简单比较,另外就是输入的代码也会干扰到补全,
个人输入的与工具本身理解不一样也会导致结果差异.

  1. 斐波那契数列 Copilot会更简洁些,二者都未有异常处理,比如溢出,输入负数.
  2. public void writeFile(String file, String content)差不多,Copilot少一行.
  3. public int dp2px(int dp)结果不同,一个是剩0.5,一个是0.3都有问题, 需要参数中手动输入Context context参数才行.
  4. public int dpToPx(Context context, int dp) 因为手动输入Context参数结果正确,个人更喜欢Codeium不需要关注运算.
  5. public String getTopActivity(Context context)二者都不正确.
  6. public boolean isAppForeground(Context context, String packageName) 二者都不正确.
  7. public boolean isAppSystem(Context context, String packageName)二者都不正确.
  8. public int getStatusBarHeight(Context context)Copilot表现比较好.
  9. public int getScreenWidth(Context context)结果一样.
  10. public String bytes2HexString(byte[] bytes)差不多.
  11. 获取时间的字符串的函数,format的格式需要自己微调.
  12. public boolean isPhoneNumber(String phoneNumber),Codeium需要手动输入部分实现,Copilot表现好.
  13. getTodayOfWeek() Copilot用到过期的函数,Codeium表现好些.
  14. public static boolean isChinese(String str)二都结果一样.
  15. 设备屏幕亮度setBrightness,获取AndroidId getAndroidId, Codeium都需要手动输入部分实现,否则补全不了,Copilot表现好.

单纯从以上对比,Copilot综合实力更强,收费的,开通麻烦点,原因你懂的.
Codeium也能解决大部分场景,它是免费的,免费的,免费的,重要的事情说三遍,开通方便.
最后说一下,土豪上Copilot,其他上Codeium.
作者:帅得不敢出门 CSDN原创谢绝转载文章来源地址https://www.toymoban.com/news/detail-631365.html

到了这里,关于AI编程工具Copilot与Codeium的实测对比的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 三款强大的 AI 编程工具,可以轻松替换 Github Copilot

    大家好,提起 Github Copilot ,相信很多读者朋友们都听说过甚至使用过,作为 Github 研发的一款先进的编程辅助插件,它可以在我们日常编写代码的过程中,根据代码的上下文内容、注释等信息自动推断生成高质量的代码,很大程度上提升我们的代码编写效率。 而自从去年8月

    2024年02月13日
    浏览(23)
  • 如何利用AI工具快速编程:从GitHub Copilot到ChatGPT

    随着人工智能技术的飞速发展,AI工具在编程领域的应用已经越来越广泛。这些工具通过利用机器学习、自然语言处理等技术,帮助开发者更快速、更高效地编写代码。本文将深入探讨几种目前最流行或最新的AI工具,包括GitHub Copilot、CodeGPT、Codey和Replit Ghostwriter,并分析它们

    2024年01月22日
    浏览(32)
  • 测试了Copilot辅助编程后,就离不开这个AI工具了

    微软用·chatGPT 4· 对·github copilot X·升级后,本是怀着赠热点的心态测试了一下其功能。但 Copilot 智能化程度之高,令我吃惊,两周下来已离开不这个工具了。 下面简单分享一下其使用过程,以及对如何使用好这个工具的个人看法. IDE开发环境我使用的是 VSCode 与 Visual Studio2

    2024年02月06日
    浏览(20)
  • Github Copilot最全的安装与使用教程:一款非常好用的AI编程工具

    GitHub Copilot 供经过验证的学生、教师和热门开源项目的维护人员免费使用。 如果你不是学生、教师或热门开源项目的维护人员,可以在一次性 30 天试用期中免费试用 GitHub Copilot。 免费试用后,需要付费订阅才能继续使用。 GitHub Copilot目前为止可以免费试用 一个月 ,但是试

    2024年01月17日
    浏览(24)
  • CodeGeeX、CodeWhisperer、Github Copilot三款AI辅助编程工具,程序员该如何选择?

    亚马逊今天在Re:Mars大会上宣布推出CodeWhisperer,这是一款类似于 CodeGeeX 和GitHub Copilot的AI辅助编程工具,它根据一个注释或几个按键来自动补全整个函数。目前支持Java、JavaScript和Python,和 CodeGeeX 一样,使用了数十亿行公开可用的开源代码、自己的代码库、公开可用的文档和公

    2023年04月16日
    浏览(28)
  • 写注释自动出代码?!在Cocos中试水AI编程工具Copilot,摸鱼神器or失业警告?

    去年的某一天,Cocos 的开发者交流群里突然爆发出一阵惊叹,有人直呼“饭碗不保”,有人忧虑版权和保密问题,也有人给出了积极的反馈—— 上下滑动查看更多 大家在讨论的 Copilot 是 OpenAI 与 GitHub 联合推出的一个 AI 自动编程工具,能根据上下文自动生成代码,供编程者参

    2024年02月09日
    浏览(18)
  • 微软和OpenAI联手推出了GitHub Copilot这一AI编程工具,可根据开发者的输入和上下文,生成高质量的代码片段和建议

    只需要写写注释,就能生成能够运行的代码?对于程序员群体来说,这绝对是一个提高生产力的超级工具,令人难以置信。实际上,早在2021年6月,微软和OpenAI联手推出了GitHub Copilot这一AI编程工具。它能够根据开发者的输入和上下文,生成高质量的代码片段和建议。这个工具

    2024年02月09日
    浏览(21)
  • Github Copilot编程工具背后的算法技术

    作者:zizhan居士 来源:投稿 编辑:学姐 前段时间大火的工具 Github Copilot 想必大家都略有耳闻,我们只需要输入一些注释说明你需要的函数功能,AI就会自动帮你编写完整的函数代码,代码逻辑、规范甚至比自己写的都好,可谓是让人瑟瑟发抖的结对编程好兄弟。 而这个工具

    2024年02月09日
    浏览(22)
  • 辅助编程coding的两种工具:Github Copilot、Cursor

    Cursor is an editor made for programming with AI. It’s early days, but right now Cursor can help you with a few things… Write: Generate 10-100 lines of code with an AI that’s smarter than Copilot Diff: Ask the AI to edit a block of code, see only proposed changes Chat: ChatGPT-style interface that understands your current file And more: ask to fix lint

    2023年04月23日
    浏览(20)
  • 辅助编程工具Github Copilot、CodeWhisperer和Cursor(程序猿必看)【收藏】-让编程变得简单轻松

    基于深度学习的辅助编程工具推出标志着辅助编程工具进入了一个互卷的时代,为开发人员提供了更强大、智能化的编程支持。 本文介绍Github Copilot、CodeWhisperer和Cursor 以下是一些使用 AI 编程插件的好处: 自动代码补全 错误检测和纠正 代码优化和重构 文档和注释生成 GitH

    2024年02月09日
    浏览(19)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包